Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: don't perform lookupCheck if not enough peers in routing table #970

Merged
merged 3 commits into from
May 7, 2024

Conversation

guillaumemichel
Copy link
Contributor

Currently, nodes will always perform a lookupCheck (FIND_PEER request where receiver should reply with at least 1 peer record) before a peer is added to the routing table, and when refreshing the routing table.

This check should be performed only if the routing table is well populated. Otherwise, it is tricky to bootstrap a new DHT network as the first peers start with an empty routing table, and are unable to provide peer to others when requested by the lookupCheck.

The check will be skipped if the routing table contains less than bucketSize peers, which means that no bucket can be full. It implies that unresponsive peers making it to the routing table because the check was skipped will get evicted once bucketSize peers are present in the routing table, and they won't prevent well behaving peers from replacing them in the routing table.

@guillaumemichel guillaumemichel marked this pull request as ready for review May 1, 2024 12:51
dht.go Outdated Show resolved Hide resolved
@guillaumemichel guillaumemichel merged commit 913d11c into master May 7, 2024
9 checks passed
@guillaumemichel guillaumemichel deleted the fix/lookup-check branch May 7, 2024 09:28
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.

2 participants