Skip to content

Commit 5998a09

Browse files
committed
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: e141beb
1 parent 5b93eee commit 5998a09

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/main.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,11 +1751,10 @@ bool IsInitialBlockDownload()
17511751
return true;
17521752
if (chainActive.Tip()->nChainWork < UintToArith256(chainParams.GetConsensus().nMinimumChainWork))
17531753
return true;
1754-
bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 ||
1755-
std::max(chainActive.Tip()->GetBlockTime(), pindexBestHeader->GetBlockTime()) < GetTime() - nMaxTipAge);
1756-
if (!state)
1757-
latchToFalse.store(true, std::memory_order_relaxed);
1758-
return state;
1754+
if (chainActive.Tip()->GetBlockTime() < (GetTime() - nMaxTipAge))
1755+
return true;
1756+
latchToFalse.store(true, std::memory_order_relaxed);
1757+
return false;
17591758
}
17601759

17611760
bool fLargeWorkForkFound = false;

0 commit comments

Comments
 (0)