IsInitialBlockDownload no longer uses header-only timestamps.

This avoids a corner case (mostly visible on testnet) where bogus
 headers can keep nodes in IsInitialBlockDownload.

Github-Pull: #9053
Rebased-From: e141beb6a9816b7e1e680fb0a8bae16d42a3e557
This commit is contained in:
Gregory Maxwell 2016-11-01 00:37:54 +00:00
parent 5b93eeebb4
commit 5998a09546

View File

@ -1751,11 +1751,10 @@ bool IsInitialBlockDownload()
return true;
if (chainActive.Tip()->nChainWork < UintToArith256(chainParams.GetConsensus().nMinimumChainWork))
return true;
bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 ||
std::max(chainActive.Tip()->GetBlockTime(), pindexBestHeader->GetBlockTime()) < GetTime() - nMaxTipAge);
if (!state)
if (chainActive.Tip()->GetBlockTime() < (GetTime() - nMaxTipAge))
return true;
latchToFalse.store(true, std::memory_order_relaxed);
return state;
return false;
}
bool fLargeWorkForkFound = false;