Add a locking mechanism to IsInitialBlockDownload to ensure it never goes from false to true.

This commit is contained in:
Ruben Dario Ponticelli 2014-11-05 20:52:27 -03:00
parent a2d0fc658a
commit 9ec75c5ef4
No known key found for this signature in database
GPG Key ID: 007D7A89C6DF7B2D

View File

@ -1177,8 +1177,14 @@ bool IsInitialBlockDownload()
LOCK(cs_main);
if (fImporting || fReindex || chainActive.Height() < Checkpoints::GetTotalBlocksEstimate())
return true;
return (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 ||
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;