Respond GRAFT with PRUNE if not subscribed to the topic
This commit is contained in:
NIC619 2019-07-18 22:37:44 +08:00
parent 84824fd566
commit e52bfe3a51
No known key found for this signature in database
GPG Key ID: 570C35F5C2D51B17

View File

@ -462,7 +462,8 @@ class GossipSub(IPubsubRouter):
if topic in self.mesh: if topic in self.mesh:
self.mesh[topic].append(from_id_str) self.mesh[topic].append(from_id_str)
else: 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): async def handle_prune(self, prune_msg, sender_peer_id):
topic = prune_msg.topicID topic = prune_msg.topicID