aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2016-11-01 00:37:54 +0000
committerGregory Maxwell <greg@xiph.org>2016-12-06 17:16:54 +0000
commit5998a09546b033e8d55f2a45d35a6161b2cdc288 (patch)
treebca5ae4ecfdf5e5ef7b3d1f0c37824e1be24b3dc
parent5b93eeebb4f7fce10a12f2e83f771bc23002c224 (diff)
downloadbitcoin-5998a09546b033e8d55f2a45d35a6161b2cdc288.tar.xz
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
-rw-r--r--src/main.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 54eff56f41..5f04c19162 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -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)
- 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;