Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

fix!: only discover bootstrap peers once and tag them on discovery #142

Merged
merged 3 commits into from
Sep 23, 2022

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Sep 22, 2022

Bootstrap peers should be used in an intial DHT self query to find peers that are KAD-close to us.

We do not need to rediscover the same peers over and over again, instead we should just discover them once, use them to query for peers near our PeerId then we can disconnect from them like any other peer

  1. Instead of "discovering" the same peers every few seconds, only discover them once
  2. Tag the peers in the peer store with an expiring value to prevent any potential connection being culled before we've used the bootstrap nodes to query for peers close to us

BREAKING CHANGE: the interval option has been renamed timeout and peers are now only discovered once

Bootstrap peers should be used in an intial DHT self query to find peers that are KAD-close to us.

We do not need to rediscover the same peers over and over again, instead we should just discover them once, use them to query for peers near our PeerId then we can disconnect from them like any other peer

Browsers peers may wish to never let the tag expire so they stay connected to the preload nodes.

1. Instead of "discovering" the same peers every few seconds, only discover them once
2. Tag the peers in the peer store with an expiring value to prevent any potential connection being culled before we've used the bootstrap nodes to query for peers close to us

BREAKING CHANGE: the `interval` option has been renamed `timeout` and peers are now only discovered once
Copy link
Member

@mpetrunic mpetrunic left a comment

Choose a reason for hiding this comment

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

Ah, great fix, this was really annoying!

@mpetrunic mpetrunic merged commit cd41d94 into master Sep 23, 2022
@mpetrunic mpetrunic deleted the fix/only-discover-bootstrap-nodes-once branch September 23, 2022 08:34
github-actions bot pushed a commit that referenced this pull request Sep 23, 2022
## [3.0.0](v2.0.1...v3.0.0) (2022-09-23)

### ⚠ BREAKING CHANGES

* the `interval` option has been renamed `timeout` and
peers are now only discovered once

### Bug Fixes

* only discover bootstrap peers once and tag them on discovery ([#142](#142)) ([cd41d94](cd41d94))
@github-actions
Copy link

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants