IsInitialBlockDownload no longer uses header-only timestamps.

This avoids a corner case (mostly visible on testnet) where bogus
 headers can keep nodes in IsInitialBlockDownload.
This commit is contained in:
Gregory Maxwell
2016-11-01 00:37:54 +00:00
committed by Jack Grigg
parent e41632c9fb
commit f04a90afb2

View File

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