Preserve enforced masternode sync failures#15
Open
NateIsern wants to merge 1 commit into
Open
Conversation
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.
Motivation
CMasternodeSync::Process()could advance sync stages (LIST->MNW->BUDGET->FINISHED) even when no masternode list or winner data was received, allowing a node to mark itself synced with empty/incomplete masternode/payment state.masternodeSync.IsSynced()) and cause payment validation to "fail open", creating the risk of producing or accepting blocks inconsistent with the network whenSPORK_8_MASTERNODE_PAYMENT_ENFORCEMENTis active.Description
src/masternode-sync.cppso the global stall timeout preserves theSPORK_8_MASTERNODE_PAYMENT_ENFORCEMENTfailure semantics: when the timeout fires and the current asset isMASTERNODE_SYNC_LISTorMASTERNODE_SYNC_MNWwith no data (lastMasternodeList == 0orlastMasternodeWinner == 0) and the spork is active, the code now setsRequestedMasternodeAssets = MASTERNODE_SYNC_FAILEDand records the failure instead of blindly callingGetNextAsset().GetNextAsset()when payment enforcement is inactive or when relevant data has been received.CMasternodeSync::Process()and does not modify consensus or block-validation rules.Testing
git diff --checkon the modified tree and there were no whitespace or diff-check issues (passed)../autogen.sh && ./configure --without-gui --disable-wallet --disable-tests && make -j2but the build could not be executed in this environment becauseaclocal(autotools) is missing, so a full compile/test was not completed.Codex Task