diff options
| author | Gregory Maxwell <[email protected]> | 2016-11-01 00:37:54 +0000 |
|---|---|---|
| committer | Gregory Maxwell <[email protected]> | 2016-11-02 01:51:53 +0000 |
| commit | e141beb6a9816b7e1e680fb0a8bae16d42a3e557 (patch) | |
| tree | f6ebeb16354d6c73114b6705d37363d3002c37e9 /src/main.cpp | |
| parent | Remove GetTotalBlocksEstimate and checkpoint tests that test nothing. (diff) | |
| download | discoin-e141beb6a9816b7e1e680fb0a8bae16d42a3e557.tar.xz discoin-e141beb6a9816b7e1e680fb0a8bae16d42a3e557.zip | |
IsInitialBlockDownload no longer uses header-only timestamps.
This avoids a corner case (mostly visible on testnet) where bogus
headers can keep nodes in IsInitialBlockDownload.
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp index 6b33539a2..46320604e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1744,11 +1744,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) - latchToFalse.store(true, std::memory_order_relaxed); - return state; + if (chainActive.Tip()->GetBlockTime() < (GetTime() - nMaxTipAge)) + return true; + latchToFalse.store(true, std::memory_order_relaxed); + return false; } bool fLargeWorkForkFound = false; |