From a2d0fc658a7b21d2d41ef2a6c657d24114b6c49e Mon Sep 17 00:00:00 2001 From: Ruben Dario Ponticelli Date: Tue, 28 Oct 2014 14:48:50 -0300 Subject: [PATCH] Fix IsInitialBlockDownload which was broken by headers first. --- src/main.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 008a05910..bf487df39 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1177,15 +1177,8 @@ bool IsInitialBlockDownload() LOCK(cs_main); if (fImporting || fReindex || chainActive.Height() < Checkpoints::GetTotalBlocksEstimate()) return true; - static int64_t nLastUpdate; - static CBlockIndex* pindexLastBest; - if (chainActive.Tip() != pindexLastBest) - { - pindexLastBest = chainActive.Tip(); - nLastUpdate = GetTime(); - } - return (GetTime() - nLastUpdate < 10 && - chainActive.Tip()->GetBlockTime() < GetTime() - 24 * 60 * 60); + return (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 || + pindexBestHeader->GetBlockTime() < GetTime() - 24 * 60 * 60); } bool fLargeWorkForkFound = false;