diff --git a/libp2p/protocols/pubsub/floodsub.nim b/libp2p/protocols/pubsub/floodsub.nim index 62d973d..cabcc7c 100644 --- a/libp2p/protocols/pubsub/floodsub.nim +++ b/libp2p/protocols/pubsub/floodsub.nim @@ -85,9 +85,13 @@ method rpcHandler*(f: FloodSub, # g.anonymize needs no evaluation when receiving messages # as we have a "lax" policy and allow signed messages - if (await f.validate(msg)) == ValidationResult.Reject: - trace "Dropping message due to failed validation", msgId, peer + let validation = await f.validate(msg) + case validation + of ValidationResult.Reject, ValidationResult.Ignore: + debug "Dropping message due to ignored validation", msgId, peer continue + of ValidationResult.Accept: + discard var toSendPeers = initHashSet[PubSubPeer]() for t in msg.topicIDs: # for every topic in the message diff --git a/libp2p/protocols/pubsub/gossipsub.nim b/libp2p/protocols/pubsub/gossipsub.nim index 9468cb7..10cdadc 100644 --- a/libp2p/protocols/pubsub/gossipsub.nim +++ b/libp2p/protocols/pubsub/gossipsub.nim @@ -1062,10 +1062,17 @@ method rpcHandler*(g: GossipSub, # g.anonymize needs no evaluation when receiving messages # as we have a "lax" policy and allow signed messages - if (await g.validate(msg)) == ValidationResult.Reject: + let validation = await g.validate(msg) + case validation + of ValidationResult.Reject: debug "Dropping message due to failed validation", msgId, peer g.punishPeer(peer, msg) continue + of ValidationResult.Ignore: + debug "Dropping message due to ignored validation", msgId, peer + continue + of ValidationResult.Accept: + discard var toSendPeers = initHashSet[PubSubPeer]() for t in msg.topicIDs: # for every topic in the message diff --git a/libp2p/protocols/pubsub/gossipsub10.nim b/libp2p/protocols/pubsub/gossipsub10.nim index cb97c10..47c542f 100644 --- a/libp2p/protocols/pubsub/gossipsub10.nim +++ b/libp2p/protocols/pubsub/gossipsub10.nim @@ -464,9 +464,13 @@ method rpcHandler*(g: GossipSub, # g.anonymize needs no evaluation when receiving messages # as we have a "lax" policy and allow signed messages - if (await g.validate(msg)) == ValidationResult.Reject: - trace "Dropping message due to failed validation", msgId, peer + let validation = await g.validate(msg) + case validation + of ValidationResult.Reject, ValidationResult.Ignore: + debug "Dropping message due to ignored validation", msgId, peer continue + of ValidationResult.Accept: + discard var toSendPeers = initHashSet[PubSubPeer]() for t in msg.topicIDs: # for every topic in the message