diff options
| author | Ruben Dario Ponticelli <[email protected]> | 2014-11-05 20:52:27 -0300 |
|---|---|---|
| committer | Ruben Dario Ponticelli <[email protected]> | 2014-11-07 08:09:31 -0300 |
| commit | 9ec75c5ef4182a38e261beaafdc94325785cc7c5 (patch) | |
| tree | 8685363dea0dcf688c127c463361225a971176ef /src/main.cpp | |
| parent | Fix IsInitialBlockDownload which was broken by headers first. (diff) | |
| download | discoin-9ec75c5ef4182a38e261beaafdc94325785cc7c5.tar.xz discoin-9ec75c5ef4182a38e261beaafdc94325785cc7c5.zip | |
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 bf487df39..0fd806534 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; |