Fix persistent PoS chain forks with deterministic tiebreaker and tighter timestamps
PoS blocks at the same height have identical difficulty, producing equal chain trust scores. The old "strictly greater" comparison meant first-seen-wins, causing permanent forks when nodes received competing blocks in different order. v5.4 fork (block 2186941) adds: - Deterministic tiebreaker: equal-trust chains resolve to the lower tip hash - Tighter time drift: ±3 min (was ±10 min), reducing the competing block window Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -365,7 +365,7 @@ CBlock* CreateNewBlock(CWallet* pwallet, bool fProofOfStake, int64_t* pFees)
|
||||
// Fill in header
|
||||
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
|
||||
pblock->nTime = max(pindexPrev->GetPastTimeLimit()+1, pblock->GetMaxTransactionTime());
|
||||
pblock->nTime = max(pblock->GetBlockTime(), PastDrift(pindexPrev->GetBlockTime()));
|
||||
pblock->nTime = max(pblock->GetBlockTime(), PastDrift(pindexPrev->GetBlockTime(), pindexPrev->nHeight + 1));
|
||||
if (!fProofOfStake)
|
||||
pblock->UpdateTime(pindexPrev);
|
||||
pblock->nNonce = 0;
|
||||
|
||||
Reference in New Issue
Block a user