diff --git a/libp2p/protocols/pubsub/gossipsub.nim b/libp2p/protocols/pubsub/gossipsub.nim index 3b79a5b50..64181bff4 100644 --- a/libp2p/protocols/pubsub/gossipsub.nim +++ b/libp2p/protocols/pubsub/gossipsub.nim @@ -37,6 +37,7 @@ logScope: declareCounter(libp2p_gossipsub_failed_publish, "number of failed publish") declareCounter(libp2p_gossipsub_invalid_topic_subscription, "number of invalid topic subscriptions that happened") +declareCounter(libp2p_gossipsub_duplicate_during_validation, "number of duplicates received during message validation") proc init*(_: type[GossipSubParams]): GossipSubParams = GossipSubParams( @@ -295,7 +296,9 @@ method rpcHandler*(g: GossipSub, for i in 0.. 0 except: false) + result = ValidationResult.Accept + bFinished.complete() + + nodes[1].addValidator("foobar", slowValidator) + + tryPublish await nodes[0].publish("foobar", "Hello!".toBytes()), 1 + + await bFinished + + await allFuturesThrowing( + nodes[0].switch.stop(), + nodes[1].switch.stop(), + nodes[2].switch.stop() + ) + + await allFuturesThrowing( + nodes[0].stop(), + nodes[1].stop(), + nodes[2].stop() + ) + + await allFuturesThrowing(nodesFut.concat()) + asyncTest "e2e - GossipSub send over floodPublish A -> B": var passed: Future[bool] = newFuture[bool]() proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} =