added randomness to peer selection (#3123)

This commit is contained in:
Simon-Pierre Vivier 2024-10-16 15:18:47 -04:00 committed by GitHub
parent 82fd5dde61
commit bdb31cc114
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -227,6 +227,8 @@ proc selectPeer*(
if shard.isSome():
peers.keepItIf((it.enr.isSome() and it.enr.get().containsShard(shard.get())))
shuffle(peers)
# No criteria for selecting a peer for WakuRelay, random one
if proto == WakuRelayCodec:
# TODO: proper heuristic here that compares peer scores and selects "best" one. For now the first peer for the given protocol is returned