mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Fix fast-shutdown crash if genesis block was not loaded
If the ShutdownRequested() check at the top of ActivateBestChain() returns false during initial genesis block load we will fail an assertion in UTXO DB flush as the best block hash IsNull(). To work around this, we move the check until after one round of ActivateBestChainStep(), ensuring the genesis block gets connected.
This commit is contained in:
parent
1c9394ad47
commit
dd2de47c62
@ -2581,9 +2581,6 @@ bool CChainState::ActivateBestChain(CValidationState &state, const CChainParams&
|
|||||||
SyncWithValidationInterfaceQueue();
|
SyncWithValidationInterfaceQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShutdownRequested())
|
|
||||||
break;
|
|
||||||
|
|
||||||
const CBlockIndex *pindexFork;
|
const CBlockIndex *pindexFork;
|
||||||
bool fInitialDownload;
|
bool fInitialDownload;
|
||||||
{
|
{
|
||||||
@ -2630,6 +2627,13 @@ bool CChainState::ActivateBestChain(CValidationState &state, const CChainParams&
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nStopAtHeight && pindexNewTip && pindexNewTip->nHeight >= nStopAtHeight) StartShutdown();
|
if (nStopAtHeight && pindexNewTip && pindexNewTip->nHeight >= nStopAtHeight) StartShutdown();
|
||||||
|
|
||||||
|
// We check shutdown only after giving ActivateBestChainStep a chance to run once so that we
|
||||||
|
// never shutdown before connecting the genesis block during LoadChainTip(). Previously this
|
||||||
|
// caused an assert() failure during shutdown in such cases as the UTXO DB flushing checks
|
||||||
|
// that the best block hash is non-null.
|
||||||
|
if (ShutdownRequested())
|
||||||
|
break;
|
||||||
} while (pindexNewTip != pindexMostWork);
|
} while (pindexNewTip != pindexMostWork);
|
||||||
CheckBlockIndex(chainparams.GetConsensus());
|
CheckBlockIndex(chainparams.GetConsensus());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user