diff options
author | Ruben Dario Ponticelli <rdponticelli@gmail.com> | 2014-11-05 20:52:27 -0300 |
---|---|---|
committer | Ruben Dario Ponticelli <rdponticelli@gmail.com> | 2014-11-07 08:09:31 -0300 |
commit | 9ec75c5ef4182a38e261beaafdc94325785cc7c5 (patch) | |
tree | 8685363dea0dcf688c127c463361225a971176ef /src/main.cpp | |
parent | a2d0fc658a7b21d2d41ef2a6c657d24114b6c49e (diff) |
Add a locking mechanism to IsInitialBlockDownload to ensure it never goes from false to true.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index bf487df39f..0fd8065342 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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; |