Enhance logs
This commit is contained in:
parent
988ef8c712
commit
68e75707e4
@ -13,6 +13,7 @@ from typing import (
|
|||||||
cast,
|
cast,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
import base58
|
||||||
from lru import LRU
|
from lru import LRU
|
||||||
|
|
||||||
from libp2p.exceptions import ValidationError
|
from libp2p.exceptions import ValidationError
|
||||||
@ -414,14 +415,19 @@ class Pubsub:
|
|||||||
# Validate the signature of the message
|
# Validate the signature of the message
|
||||||
# FIXME: `signature_validator` is currently a stub.
|
# FIXME: `signature_validator` is currently a stub.
|
||||||
if not signature_validator(msg.key, msg.SerializeToString()):
|
if not signature_validator(msg.key, msg.SerializeToString()):
|
||||||
log.debug(f"Signature validation failed for msg={msg}")
|
log.debug("Signature validation failed for msg: %s", msg)
|
||||||
return
|
return
|
||||||
# Validate the message with registered topic validators.
|
# Validate the message with registered topic validators.
|
||||||
# If the validation failed, return(i.e., don't further process the message).
|
# If the validation failed, return(i.e., don't further process the message).
|
||||||
try:
|
try:
|
||||||
await self.validate_msg(msg_forwarder, msg)
|
await self.validate_msg(msg_forwarder, msg)
|
||||||
except ValidationError:
|
except ValidationError:
|
||||||
log.debug(f"Topic validation failed for msg={msg}")
|
log.debug(
|
||||||
|
"Topic validation failed: sender %s sent data %s under topic IDs: %s",
|
||||||
|
f"{base58.b58encode(msg.from_id).decode()}:{msg.seqno.hex()}",
|
||||||
|
msg.data,
|
||||||
|
msg.topicIDs,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
self._mark_msg_seen(msg)
|
self._mark_msg_seen(msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user