Skip to content

Conversation

@igor-sirotin
Copy link
Collaborator

@igor-sirotin igor-sirotin commented Nov 13, 2025

Fixes:

Description

If filteredPeers were empty, then PeersByPubSubTopics would use all known peers:
https://github.com/waku-org/go-waku/blob/8ff8779bb06c444386ff863aa052a69a8cfba862/waku/v2/peerstore/waku_peer_store.go#L228-L231

... which would effectively removes filtering by protocol.

Also:

  • refactored the code.
  • moved selectWithLowestRTT test part to the end, as it modifies hosts protocols and breaks other tests
  • fixed a bug in calling selectRandomPeers, which incorrectly calculates count:
    randomPeers, err := selectRandomPeers(filteredPeers, nil, criteria.MaxPeers-len(peerIDs))

Copy link
Collaborator

@chaitanyaprem chaitanyaprem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@status-im-auto
Copy link

status-im-auto commented Nov 27, 2025

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ 99b3ab5 #1 2025-11-27 14:23:01 ~13 days unknown 📄log
✖️ 237c679 #2 2025-11-27 14:23:54 ~43 sec unknown 📄log

@igor-sirotin igor-sirotin requested a review from osmaczko December 8, 2025 20:32
@igor-sirotin igor-sirotin merged commit 5635735 into master Dec 8, 2025
14 checks passed
@igor-sirotin igor-sirotin deleted the fix/select-random branch December 8, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants