From e52bfe3a51a46057cb5735eb2f845b0994ac9e6b Mon Sep 17 00:00:00 2001 From: NIC619 Date: Thu, 18 Jul 2019 22:37:44 +0800 Subject: [PATCH] Fix: Respond GRAFT with PRUNE if not subscribed to the topic --- libp2p/pubsub/gossipsub.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libp2p/pubsub/gossipsub.py b/libp2p/pubsub/gossipsub.py index 01576ae..f1d057c 100644 --- a/libp2p/pubsub/gossipsub.py +++ b/libp2p/pubsub/gossipsub.py @@ -462,7 +462,8 @@ class GossipSub(IPubsubRouter): if topic in self.mesh: self.mesh[topic].append(from_id_str) else: - self.mesh[topic] = [from_id_str] + # Respond with PRUNE if not subscribed to the topic + await self.emit_prune(topic, sender_peer_id) async def handle_prune(self, prune_msg, sender_peer_id): topic = prune_msg.topicID