IBD check uses minimumchain work instead of checkpoints.

This commit is contained in:
Gregory Maxwell
2016-10-22 05:33:25 +00:00
committed by lateminer
parent 75402d67c1
commit 1bf644c43f
3 changed files with 15 additions and 2 deletions

View File

@@ -1698,7 +1698,9 @@ bool IsInitialBlockDownload()
LOCK(cs_main);
if (fImporting || fReindex)
return true;
if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()))
if (chainActive.Tip() == NULL)
return true;
if (chainActive.Tip()->nChainWork < UintToArith256(chainParams.GetConsensus().nMinimumChainWork))
return true;
static bool lockIBDState = false;
if (lockIBDState)
@@ -1738,7 +1740,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;