Skip to content

Preserve enforced masternode sync failures#15

Open
NateIsern wants to merge 1 commit into
mainfrom
codex/fix-masternode-sync-logic-flaw
Open

Preserve enforced masternode sync failures#15
NateIsern wants to merge 1 commit into
mainfrom
codex/fix-masternode-sync-logic-flaw

Conversation

@NateIsern

Copy link
Copy Markdown
Member

Motivation

  • The unconditional stall timeout in 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.
  • A falsely finished masternode sync can unblock PoS staking (masternodeSync.IsSynced()) and cause payment validation to "fail open", creating the risk of producing or accepting blocks inconsistent with the network when SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT is active.

Description

  • Change src/masternode-sync.cpp so the global stall timeout preserves the SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT failure semantics: when the timeout fires and the current asset is MASTERNODE_SYNC_LIST or MASTERNODE_SYNC_MNW with no data (lastMasternodeList == 0 or lastMasternodeWinner == 0) and the spork is active, the code now sets RequestedMasternodeAssets = MASTERNODE_SYNC_FAILED and records the failure instead of blindly calling GetNextAsset().
  • Keep the original recovery behavior for empty/small networks by still advancing assets via GetNextAsset() when payment enforcement is inactive or when relevant data has been received.
  • The change is local to CMasternodeSync::Process() and does not modify consensus or block-validation rules.

Testing

  • Ran git diff --check on the modified tree and there were no whitespace or diff-check issues (passed).
  • Attempted a full build with ./autogen.sh && ./configure --without-gui --disable-wallet --disable-tests && make -j2 but the build could not be executed in this environment because aclocal (autotools) is missing, so a full compile/test was not completed.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant