masternode|net|rpc: Improve masternode sync process#3690
Merged
UdjinM6 merged 11 commits intoSep 11, 2020
Conversation
68f01ba to
41288bd
Compare
|
Need rebase |
41288bd to
86ffb1b
Compare
Author
Done, and tests should pass too now! 🤞 |
I would say its enough to only wait 1 tick if we have more than 3 peers before we move over to governance sync.
Without this it takes one iteration more for the UI to receive the update.
Give it MASTERNODE_SYNC_RESET_SECONDS (600) seconds time after the last UpdateBlockTip call.
This will reset the sync process if its outdated in the following cases: - If the connections dropped to zero - If the connections went from zero to one - If the network has been enabled or disabled
7d116fe to
9f5d280
Compare
UdjinM6
reviewed
Sep 10, 2020
UdjinM6
left a comment
There was a problem hiding this comment.
Makes sense overall, few suggestions
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
Hmmm... feature_llmq_simplepose.py is failing even locally now, need to investigate a bit
In general it doesn't make sense to connect to masternodes before due to MNAUTH requires blockchain sync. This could lead to failing quorum connections/failing masternode probing.. if a just restarted node/a out of sync node would hit a dkg block.. Then they would not try to open those llmq/probing connections for the next 60s (nLLMQConnectionRetryTimeout). Thats basically what happens in tests right now and they fail without this commit.
Author
|
Yeah i was on the failing test for a while now...see commit message of f3baf15 which is the fix. Actually it feels like it should be a separate PR as its kind of unrelated but i added it here now. If someone still wants to have it separated let me know. |
Author
|
Damn i really felt it would work without 0cdd64e now.... but looks like it doesn't :D |
|
I don't think |
Their sync might be out of date otherwise due to bigger mocktime bumps
0cdd64e to
de4318c
Compare
Author
|
I think i got the right place to force the sync now in de4318c |
xdustinface
added a commit
to xdustinface/dash
that referenced
this pull request
Sep 12, 2020
* masternode: Replace sync states INITIAL and WAITING with BLOCKCHAIN * masternode: Peer dependent "assume tip" timeout I would say its enough to only wait 1 tick if we have more than 3 peers before we move over to governance sync. * masternode: Notify the UI instantly if switched to governance sync Without this it takes one iteration more for the UI to receive the update. * masternode: Notify the UI about CMasternodeSync::Reset calls * masternode: Don't instantly reset the sync process Give it MASTERNODE_SYNC_RESET_SECONDS (600) seconds time after the last UpdateBlockTip call. * rpc: Don't switch to next asset in "mnsync reset" * rpc: Force the reset in "mnsync reset" * net: Make sure the sync gets a reset if required after network changes This will reset the sync process if its outdated in the following cases: - If the connections dropped to zero - If the connections went from zero to one - If the network has been enabled or disabled * Apply suggestions from code review Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * net: Only open masternode connections if the blockchain is synced In general it doesn't make sense to connect to masternodes before due to MNAUTH requires blockchain sync. This could lead to failing quorum connections/failing masternode probing.. if a just restarted node/a out of sync node would hit a dkg block.. Then they would not try to open those llmq/probing connections for the next 60s (nLLMQConnectionRetryTimeout). Thats basically what happens in tests right now and they fail without this commit. * test: Make sure nodes are synced when they get restored after isolation Their sync might be out of date otherwise due to bigger mocktime bumps Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
gades
pushed a commit
to cosanta/cosanta-core
that referenced
this pull request
Mar 22, 2022
* masternode: Replace sync states INITIAL and WAITING with BLOCKCHAIN * masternode: Peer dependent "assume tip" timeout I would say its enough to only wait 1 tick if we have more than 3 peers before we move over to governance sync. * masternode: Notify the UI instantly if switched to governance sync Without this it takes one iteration more for the UI to receive the update. * masternode: Notify the UI about CMasternodeSync::Reset calls * masternode: Don't instantly reset the sync process Give it MASTERNODE_SYNC_RESET_SECONDS (600) seconds time after the last UpdateBlockTip call. * rpc: Don't switch to next asset in "mnsync reset" * rpc: Force the reset in "mnsync reset" * net: Make sure the sync gets a reset if required after network changes This will reset the sync process if its outdated in the following cases: - If the connections dropped to zero - If the connections went from zero to one - If the network has been enabled or disabled * Apply suggestions from code review Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> * net: Only open masternode connections if the blockchain is synced In general it doesn't make sense to connect to masternodes before due to MNAUTH requires blockchain sync. This could lead to failing quorum connections/failing masternode probing.. if a just restarted node/a out of sync node would hit a dkg block.. Then they would not try to open those llmq/probing connections for the next 60s (nLLMQConnectionRetryTimeout). Thats basically what happens in tests right now and they fail without this commit. * test: Make sure nodes are synced when they get restored after isolation Their sync might be out of date otherwise due to bigger mocktime bumps Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes some inconsistency issues in the masternode sync process e.g. if connections dropped or network has been disabled. It also combines the two states
MASTERNODE_SYNC_INITIALMASTERNODE_SYNC_WAITINGinto one:
MASTERNODE_SYNC_BLOCKCHAIN.Just didn't see a reason to stick with the initial state as it seems simpler to me with only having states representing what actually happens at the time. If that has some deeper idea i didn't see yet, let me know.
7d9ab2199869e177ce111ecac71160bb8303eee2 decreases the timeout (30s to 6s) between the transition
MASTERNODE_SYNC_BLOCKCHAIN -> MASTERNODE_SYNC_GOVERNANCEif the client has more than three connected peers. Idea is that i guess we can assume, if one has more than 3 connections and there was no update for 6 seconds chances are very low that there is more to come, no? And if there is more to come the process will either get a reset or will just catch up properly later. Will still be 30s for less than three tried peers.bcafa734f078cf2ca86dd7394f99560d60bc34bc makes sure the UI gets an update if the masterrnode sync receives a reset. This is a preparation for a Qt-PR i have to come next. If someone feels this should rather be moved to the Qt-PR then, please cry. For me it felt better to put it in here.
Rest should be obvious, see commits.