mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-10 23:20:55 +00:00
Remove unneccessary filter and check in gossipsub
This commit is contained in:
@ -320,10 +320,7 @@ class GossipSub(IPubsubRouter):
|
|||||||
topic, self.degree - num_mesh_peers_in_topic, self.mesh[topic]
|
topic, self.degree - num_mesh_peers_in_topic, self.mesh[topic]
|
||||||
)
|
)
|
||||||
|
|
||||||
fanout_peers_not_in_mesh: List[ID] = [
|
for peer in selected_peers:
|
||||||
peer for peer in selected_peers if peer not in self.mesh[topic]
|
|
||||||
]
|
|
||||||
for peer in fanout_peers_not_in_mesh:
|
|
||||||
# Add peer to mesh[topic]
|
# Add peer to mesh[topic]
|
||||||
self.mesh[topic].append(peer)
|
self.mesh[topic].append(peer)
|
||||||
|
|
||||||
@ -377,12 +374,7 @@ class GossipSub(IPubsubRouter):
|
|||||||
)
|
)
|
||||||
|
|
||||||
for peer in peers_to_emit_ihave_to:
|
for peer in peers_to_emit_ihave_to:
|
||||||
# TODO: this line is a monster, can hopefully be simplified
|
if peer not in self.mesh[topic]:
|
||||||
if (
|
|
||||||
topic not in self.mesh or (peer not in self.mesh[topic])
|
|
||||||
) and (
|
|
||||||
topic not in self.fanout or (peer not in self.fanout[topic])
|
|
||||||
):
|
|
||||||
msg_id_strs = [str(msg_id) for msg_id in msg_ids]
|
msg_id_strs = [str(msg_id) for msg_id in msg_ids]
|
||||||
await self.emit_ihave(topic, msg_id_strs, peer)
|
await self.emit_ihave(topic, msg_id_strs, peer)
|
||||||
|
|
||||||
@ -399,10 +391,7 @@ class GossipSub(IPubsubRouter):
|
|||||||
topic, self.degree, []
|
topic, self.degree, []
|
||||||
)
|
)
|
||||||
for peer in peers_to_emit_ihave_to:
|
for peer in peers_to_emit_ihave_to:
|
||||||
if (
|
if peer not in self.fanout[topic]:
|
||||||
peer not in self.mesh[topic]
|
|
||||||
and peer not in self.fanout[topic]
|
|
||||||
):
|
|
||||||
msg_id_strs = [str(msg) for msg in msg_ids]
|
msg_id_strs = [str(msg) for msg in msg_ids]
|
||||||
await self.emit_ihave(topic, msg_id_strs, peer)
|
await self.emit_ihave(topic, msg_id_strs, peer)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user