Merge 7110d455eb into merged_master (Bitcoin PR #12980)

This commit is contained in:
Andrew Poelstra 2020-10-29 19:54:46 +00:00
commit 96169f79e3
3 changed files with 3 additions and 0 deletions

View file

@ -4156,6 +4156,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);