Skip to content

Commit c45cbaf

Browse files
committed
Fix stopatheight
Moves stopatheight check into the ActivateBestChain loop so that the block height is actually checked and stopped at the appropriate time.
1 parent 76f268b commit c45cbaf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/validation.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2294,6 +2294,7 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
22942294

22952295
CBlockIndex *pindexMostWork = NULL;
22962296
CBlockIndex *pindexNewTip = NULL;
2297+
int nStopAtHeight = GetArg("-stopatheight", DEFAULT_STOPATHEIGHT);
22972298
do {
22982299
boost::this_thread::interruption_point();
22992300
if (ShutdownRequested())
@@ -2343,6 +2344,8 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
23432344
if (pindexFork != pindexNewTip) {
23442345
uiInterface.NotifyBlockTip(fInitialDownload, pindexNewTip);
23452346
}
2347+
2348+
if (nStopAtHeight && pindexNewTip && pindexNewTip->nHeight >= nStopAtHeight) StartShutdown();
23462349
} while (pindexNewTip != pindexMostWork);
23472350
CheckBlockIndex(chainparams.GetConsensus());
23482351

@@ -2351,9 +2354,6 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
23512354
return false;
23522355
}
23532356

2354-
int nStopAtHeight = GetArg("-stopatheight", DEFAULT_STOPATHEIGHT);
2355-
if (nStopAtHeight && pindexNewTip && pindexNewTip->nHeight >= nStopAtHeight) StartShutdown();
2356-
23572357
return true;
23582358
}
23592359

0 commit comments

Comments
 (0)