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…
Reference in New Issue