mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
init: allow shutdown during 'Activating best chain...'
Two-line patch to make it possible to shut down bitcoind cleanly during the initial ActivateBestChain. Fixes #6459 (among other complaints). To reproduce: - shutdown bitcoind - copy chainstate - start bitcoind - let the chain sync a bit - shutdown bitcoind - copy back old chainstate - start bitcoind - bitcoind will catch up with all blocks during Init() (the `boost::this_thread::interruption_point` / `ShutdownRequested()` dance is ugly, this should be refactored all over bitcoind at some point when moving from boost::threads to c++11 threads, but it works...)
This commit is contained in:
parent
1b2460bd58
commit
07398e8e9d
@ -2877,6 +2877,8 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
|
|||||||
CBlockIndex *pindexMostWork = NULL;
|
CBlockIndex *pindexMostWork = NULL;
|
||||||
do {
|
do {
|
||||||
boost::this_thread::interruption_point();
|
boost::this_thread::interruption_point();
|
||||||
|
if (ShutdownRequested())
|
||||||
|
break;
|
||||||
|
|
||||||
CBlockIndex *pindexNewTip = NULL;
|
CBlockIndex *pindexNewTip = NULL;
|
||||||
const CBlockIndex *pindexFork;
|
const CBlockIndex *pindexFork;
|
||||||
|
Loading…
Reference in New Issue
Block a user