prevent selecting peers from topic not in peer topics
This commit is contained in:
NIC619 2019-07-18 19:39:01 +08:00
parent b5c3420c16
commit 404dc67e83
No known key found for this signature in database
GPG Key ID: 570C35F5C2D51B17

View File

@ -191,6 +191,7 @@ class GossipSub(IPubsubRouter):
# There are less than D peers (let this number be x) # There are less than D peers (let this number be x)
# in the fanout for a topic (or the topic is not in the fanout). # in the fanout for a topic (or the topic is not in the fanout).
# Selects the remaining number of peers (D-x) from peers.gossipsub[topic]. # Selects the remaining number of peers (D-x) from peers.gossipsub[topic].
if topic in self.pubsub.peer_topics:
gossipsub_peers_in_topic = [peer for peer in self.pubsub.peer_topics[topic] gossipsub_peers_in_topic = [peer for peer in self.pubsub.peer_topics[topic]
if peer in self.peers_gossipsub] if peer in self.peers_gossipsub]
selected_peers = \ selected_peers = \