mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Fix stopatheight
Moves stopatheight check into the ActivateBestChain loop so that the block height is actually checked and stopped at the appropriate time.
This commit is contained in:
parent
76f268b9bd
commit
c45cbaf69f
@ -2294,6 +2294,7 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
|
||||
|
||||
CBlockIndex *pindexMostWork = NULL;
|
||||
CBlockIndex *pindexNewTip = NULL;
|
||||
int nStopAtHeight = GetArg("-stopatheight", DEFAULT_STOPATHEIGHT);
|
||||
do {
|
||||
boost::this_thread::interruption_point();
|
||||
if (ShutdownRequested())
|
||||
@ -2343,6 +2344,8 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
|
||||
if (pindexFork != pindexNewTip) {
|
||||
uiInterface.NotifyBlockTip(fInitialDownload, pindexNewTip);
|
||||
}
|
||||
|
||||
if (nStopAtHeight && pindexNewTip && pindexNewTip->nHeight >= nStopAtHeight) StartShutdown();
|
||||
} while (pindexNewTip != pindexMostWork);
|
||||
CheckBlockIndex(chainparams.GetConsensus());
|
||||
|
||||
@ -2351,9 +2354,6 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
|
||||
return false;
|
||||
}
|
||||
|
||||
int nStopAtHeight = GetArg("-stopatheight", DEFAULT_STOPATHEIGHT);
|
||||
if (nStopAtHeight && pindexNewTip && pindexNewTip->nHeight >= nStopAtHeight) StartShutdown();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user