Merge #9053: IBD using chainwork instead of height and not using header timestamps
e141bebIsInitialBlockDownload no longer uses header-only timestamps. (Gregory Maxwell)2082b55Remove GetTotalBlocksEstimate and checkpoint tests that test nothing. (Gregory Maxwell)fd46136IBD check uses minimumchain work instead of checkpoints. (Gregory Maxwell)
This commit is contained in:
+8
-7
@@ -1746,13 +1746,14 @@ bool IsInitialBlockDownload()
|
||||
return false;
|
||||
if (fImporting || fReindex)
|
||||
return true;
|
||||
if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()))
|
||||
if (chainActive.Tip() == NULL)
|
||||
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()->nChainWork < UintToArith256(chainParams.GetConsensus().nMinimumChainWork))
|
||||
return true;
|
||||
if (chainActive.Tip()->GetBlockTime() < (GetTime() - nMaxTipAge))
|
||||
return true;
|
||||
latchToFalse.store(true, std::memory_order_relaxed);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool fLargeWorkForkFound = false;
|
||||
@@ -1780,7 +1781,7 @@ void CheckForkWarningConditions()
|
||||
{
|
||||
AssertLockHeld(cs_main);
|
||||
// Before we get past initial download, we cannot reliably alert about forks
|
||||
// (we assume we don't get stuck on a fork before the last checkpoint)
|
||||
// (we assume we don't get stuck on a fork before finishing our initial sync)
|
||||
if (IsInitialBlockDownload())
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user