mirror of
https://github.com/status-im/nim-libp2p.git
synced 2025-02-10 03:55:30 +00:00
add an hard cap to PX
This commit is contained in:
parent
585cfc5996
commit
ce61d84db4
@ -330,6 +330,8 @@ proc peerExchangeList(g: GossipSub, topic: string): seq[PeerInfoMsg] =
|
||||
var peers = g.gossipsub.getOrDefault(topic, initHashSet[PubSubPeer]()).toSeq()
|
||||
peers.keepIf do (x: PubSubPeer) -> bool:
|
||||
x.score >= 0.0
|
||||
# by spec, larger then Dhi, but let's put some hard caps
|
||||
peers.setLen(min(peers.len, GossipSubDhi * 2))
|
||||
peers.map do (x: PubSubPeer) -> PeerInfoMsg:
|
||||
PeerInfoMsg(peerID: x.peerId.getBytes())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user