Add missing cleanup in gossipsub remove_peer
This commit is contained in:
parent
357341e0d8
commit
a7e0c5d737
|
@ -145,6 +145,21 @@ class GossipSub(IPubsubRouter):
|
|||
elif peer_id in self.peers_floodsub:
|
||||
self.peers_floodsub.remove(peer_id)
|
||||
|
||||
for topic in self.mesh:
|
||||
if peer_id in self.mesh[topic]:
|
||||
# Delete the entry if no other peers left
|
||||
if len(self.mesh[topic]) == 1:
|
||||
del self.mesh[topic]
|
||||
else:
|
||||
self.mesh[topic].remove(peer_id)
|
||||
for topic in self.fanout:
|
||||
if peer_id in self.fanout[topic]:
|
||||
# Delete the entry if no other peers left
|
||||
if len(self.fanout[topic]) == 1:
|
||||
del self.fanout[topic]
|
||||
else:
|
||||
self.fanout[topic].remove(peer_id)
|
||||
|
||||
self.peers_to_protocol.pop(peer_id, None)
|
||||
|
||||
async def handle_rpc(self, rpc: rpc_pb2.RPC, sender_peer_id: ID) -> None:
|
||||
|
|
Loading…
Reference in New Issue
Block a user