Skip to content

Peer/sync manager improvements#470

Merged
zquestz merged 2 commits intogcash:masterfrom
simpleledgerinc:master
May 20, 2021
Merged

Peer/sync manager improvements#470
zquestz merged 2 commits intogcash:masterfrom
simpleledgerinc:master

Conversation

@jcramer
Copy link
Contributor

@jcramer jcramer commented May 20, 2021

There are two improvements here for the peer manager.

The first commit fixes an issue where in regtest mode bchd wouldn't connect to some other nodes that don't advertise full node service in while in regtest mode. This behavior was already baked in, but it was broken by my previous commit 9392a9 adding sm.regTestSyncAnyHost.

The second commit addresses an issue where some peers may become valid sync peers but the peer's syncCandidate is stuck at false because at some time their block height was less than ours (see manager.go new line 354).

jcramer added 2 commits May 17, 2021 20:52
Some node software does not advertise full node service
when in regtest mode.  We only want to check services
when we're not running in regression test mode.
There was a problem with the previous code used to select a
sync peer when none exists, which happens if we lose our sync
peer or if we fail to establish a sync peer.

The early exit statement didn't first re-check if the peer is a
possible syncCandidate before exiting.  This would have been
fine if 'syncCandidate' wasn't also possibly being changed in
the following 'peer.LastBlock() < best.Height' conditional.

This fix allows peer nodes to become sync candidates at a later
time if they were ever marked as a non-sync peer candidate.  This
could happen if previously checked peer was behind, and then later
surpassed our node.
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