p2p/pex: consult seeds in crawlPeersRoutine#3647
p2p/pex: consult seeds in crawlPeersRoutine#3647ebuchman merged 2 commits intotendermint:developfrom Polychain:pex-seedmode-seeds
Conversation
This changeset alters the startup behavior for crawlPeersRoutine. Previously the routine would crawl a random selection of peers on startup. For a new seed node, there are no peers. As a result, new seed nodes are unable to bootstrap themselves with a list of peers until another node with a list of peers connects to the seed. If this node relies on the seed node for peers, then the two will not discover more peers. This changeset makes the startup behavior for crawlPeersRoutine connect to any seed nodes. Upon connecting, a request for peers will be sent to the seed node thus helping bootstrap our seed node.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3647 +/- ##
===========================================
+ Coverage 63.33% 63.35% +0.01%
===========================================
Files 217 217
Lines 18169 18172 +3
===========================================
+ Hits 11507 11512 +5
+ Misses 5701 5696 -5
- Partials 961 964 +3
🚀 New features to boost your workflow:
|
ebuchman
left a comment
There was a problem hiding this comment.
Thanks for this! Minor feedback on possibly improving the checkSeeds method.
p2p/pex/pex_reactor.go
Outdated
| return err | ||
| } else if numOnline == 0 && r.book.Empty() { | ||
| return errors.New("Address book is empty, and could not connect to any seed nodes") | ||
| return errors.New("Address book is empty and no seed nodes") |
There was a problem hiding this comment.
This error message could be more clear and better synchronized with the result of checkSeeds.
For instance, checkSeeds could return -1 and a nil error to indicate there are no seeds, which isn't captured here.
checkSeeds should probably do a better job of returning errors, and for instance return an error indicating there are no seeds rather than using the special case of -1.
There was a problem hiding this comment.
What would you prefer the error message to say?
Do you want me to make changes to return values for checkSeeds - largely I tried to minimize the diff but if you have a strategy/direction you want this to go I am happy to make the changes. I am not familiar with the proper way to return and handle different "types" of errors in Go or what you prefer for tendermint so just let me know.
There was a problem hiding this comment.
No worries I realized we actually don't want to error on empty seeds list since that would cause the node not to start, which isn't what we want. So everything is fine. If you could just accept the one suggestion we can merge. Thanks for the fix!
Co-Authored-By: Ethan Buchman <ethan@coinculture.info>
|
@ebuchman I have accepted the suggestion. |
* p2p/pex: consult seeds in crawlPeersRoutine This changeset alters the startup behavior for crawlPeersRoutine. Previously the routine would crawl a random selection of peers on startup. For a new seed node, there are no peers. As a result, new seed nodes are unable to bootstrap themselves with a list of peers until another node with a list of peers connects to the seed. If this node relies on the seed node for peers, then the two will not discover more peers. This changeset makes the startup behavior for crawlPeersRoutine connect to any seed nodes. Upon connecting, a request for peers will be sent to the seed node thus helping bootstrap our seed node. * p2p/pex: Adjust error message for no peers Co-Authored-By: Ethan Buchman <ethan@coinculture.info>
* p2p/pex: consult seeds in crawlPeersRoutine This changeset alters the startup behavior for crawlPeersRoutine. Previously the routine would crawl a random selection of peers on startup. For a new seed node, there are no peers. As a result, new seed nodes are unable to bootstrap themselves with a list of peers until another node with a list of peers connects to the seed. If this node relies on the seed node for peers, then the two will not discover more peers. This changeset makes the startup behavior for crawlPeersRoutine connect to any seed nodes. Upon connecting, a request for peers will be sent to the seed node thus helping bootstrap our seed node. * p2p/pex: Adjust error message for no peers Co-Authored-By: Ethan Buchman <ethan@coinculture.info>
This changeset alters the startup behavior for crawlPeersRoutine. Previously
the routine would crawl a random selection of peers on startup. For a
new seed node, there are no peers. As a result, new seed nodes are unable
to bootstrap themselves with a list of peers until another node with a list
of peers connects to the seed. If this node relies on the seed node for peers,
then the two will not discover more peers.
This changeset makes the startup behavior for crawlPeersRoutine connect to
any seed nodes. Upon connecting, a request for peers will be sent to the seed node
thus helping bootstrap our seed node.