Skip to content

Commit e141beb

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.
1 parent 2082b55 commit e141beb

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
@@ -1744,11 +1744,10 @@ bool IsInitialBlockDownload()
17441744
return true;
17451745
if (chainActive.Tip()->nChainWork < UintToArith256(chainParams.GetConsensus().nMinimumChainWork))
17461746
return true;
1747-
bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 ||
1748-
std::max(chainActive.Tip()->GetBlockTime(), pindexBestHeader->GetBlockTime()) < GetTime() - nMaxTipAge);
1749-
if (!state)
1750-
latchToFalse.store(true, std::memory_order_relaxed);
1751-
return state;
1747+
if (chainActive.Tip()->GetBlockTime() < (GetTime() - nMaxTipAge))
1748+
return true;
1749+
latchToFalse.store(true, std::memory_order_relaxed);
1750+
return false;
17521751
}
17531752

17541753
bool fLargeWorkForkFound = false;

0 commit comments

Comments
 (0)