Browse Source

Merge pull request #5158

9ec75c5 Add a locking mechanism to IsInitialBlockDownload to ensure it never goes from false to true. (Ruben Dario Ponticelli)
a2d0fc6 Fix IsInitialBlockDownload which was broken by headers first. (Ruben Dario Ponticelli)
0.10
Wladimir J. van der Laan 10 years ago
parent
commit
9ff0bc9beb
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 17
      src/main.cpp

17
src/main.cpp

@ -1199,15 +1199,14 @@ bool IsInitialBlockDownload() @@ -1199,15 +1199,14 @@ 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);
static bool lockIBDState = false;
if (lockIBDState)
return false;
bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 ||
pindexBestHeader->GetBlockTime() < GetTime() - 24 * 60 * 60);
if (!state)
lockIBDState = true;
return state;
}
bool fLargeWorkForkFound = false;

Loading…
Cancel
Save