From 2bfa374729b32283e0c96eed7785e4f466101bf5 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sun, 11 Jun 2017 13:51:46 +0200 Subject: [PATCH] Merge #10569: Fix stopatheight c45cbaf Fix stopatheight (Andrew Chow) Tree-SHA512: 7df07ca1d40a5a3a8d93ad8943cd04954d587e19bbb63ed084b7aff9503788ec73a1045fbfc4a36d9775975032c2ee0bcc76eb4da10e879f483eaa6f351c19b2 --- src/validation.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index 9756d96f6..f658d777f 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2957,6 +2957,7 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, CBlockIndex *pindexMostWork = NULL; CBlockIndex *pindexNewTip = NULL; + int nStopAtHeight = gArgs.GetArg("-stopatheight", DEFAULT_STOPATHEIGHT); do { boost::this_thread::interruption_point(); if (ShutdownRequested()) @@ -3006,6 +3007,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()); @@ -3014,9 +3017,6 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, return false; } - int nStopAtHeight = gArgs.GetArg("-stopatheight", DEFAULT_STOPATHEIGHT); - if (nStopAtHeight && pindexNewTip && pindexNewTip->nHeight >= nStopAtHeight) StartShutdown(); - return true; }