diff options
| author | Andrew Chow <[email protected]> | 2017-06-09 11:38:30 -0700 |
|---|---|---|
| committer | Andrew Chow <[email protected]> | 2017-06-09 13:40:45 -0700 |
| commit | c45cbaf69f4fe6c8dabd48205da3bf302ed99c8a (patch) | |
| tree | ba40d6362ba07432aa50de553938daa525d5c541 /src/validation.cpp | |
| parent | Merge #10521: Limit variable scope (diff) | |
| download | discoin-c45cbaf69f4fe6c8dabd48205da3bf302ed99c8a.tar.xz discoin-c45cbaf69f4fe6c8dabd48205da3bf302ed99c8a.zip | |
Fix stopatheight
Moves stopatheight check into the ActivateBestChain loop so that the block height is actually checked and stopped at the appropriate time.
Diffstat (limited to 'src/validation.cpp')
| -rw-r--r-- | src/validation.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index eaefa9541..9fd6bee2a 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -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; } |