diff options
| author | Ross Nicoll <[email protected]> | 2021-08-04 09:28:08 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-08-04 09:28:08 +0100 |
| commit | 7ebedc2aa34b498b8005cc50f75db45a5c1ede07 (patch) | |
| tree | 57ded1e321867d2237089774354ff6edf483b56c /src/validation.cpp | |
| parent | Merge pull request #2428 from zachlatta/1.14.4-nixos-build-instructions (diff) | |
| parent | bugfix: break ActivateBestChain() differently on shutdown (diff) | |
| download | discoin-7ebedc2aa34b498b8005cc50f75db45a5c1ede07.tar.xz discoin-7ebedc2aa34b498b8005cc50f75db45a5c1ede07.zip | |
Merge pull request #2434 from patricklodder/1.14-activatebestchain-shutdown-fix
bugfix: break ActivateBestChain() differently on shutdown
Diffstat (limited to 'src/validation.cpp')
| -rw-r--r-- | src/validation.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index 46e586415..35778a2e7 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2504,9 +2504,6 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, CBlockIndex *pindexMostWork = NULL; CBlockIndex *pindexNewTip = NULL; do { - boost::this_thread::interruption_point(); - if (ShutdownRequested()) - break; const CBlockIndex *pindexFork; ConnectTrace connectTrace; @@ -2566,6 +2563,15 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, if (pindexFork != pindexNewTip) { uiInterface.NotifyBlockTip(fInitialDownload, pindexNewTip); } + + // Perform the shutdown detection to the end of the loop to prevent + // pindexNewTip being nil + boost::this_thread::interruption_point(); + if (ShutdownRequested()) { + LogPrintf("ActivateBestChain: shutdown requested, breaking loop\n"); + break; + } + } while (pindexNewTip != pindexMostWork); CheckBlockIndex(chainparams.GetConsensus(pindexNewTip->nHeight)); |