Allow quicker shutdowns during LoadBlockIndex()

This commit is contained in:
Jonas Schnelli
2018-04-13 21:20:29 +02:00
parent f030410e88
commit af5fa82b67
3 changed files with 3 additions and 0 deletions

View File

@@ -3855,6 +3855,7 @@ bool CChainState::LoadBlockIndex(const Consensus::Params& consensus_params, CBlo
sort(vSortedByHeight.begin(), vSortedByHeight.end());
for (const std::pair<int, CBlockIndex*>& item : vSortedByHeight)
{
if (ShutdownRequested()) return false;
CBlockIndex* pindex = item.second;
pindex->nChainWork = (pindex->pprev ? pindex->pprev->nChainWork : 0) + GetBlockProof(*pindex);
pindex->nTimeMax = (pindex->pprev ? std::max(pindex->pprev->nTimeMax, pindex->nTime) : pindex->nTime);