Skip to content

Commit

Permalink
IsInitialBlockDownload no longer uses header-only timestamps.
Browse files Browse the repository at this point in the history
This avoids a corner case (mostly visible on testnet) where bogus
 headers can keep nodes in IsInitialBlockDownload.
  • Loading branch information
gmaxwell committed Nov 2, 2016
1 parent 2082b55 commit e141beb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit e141beb

Please sign in to comment.