From 9ec75c5ef4182a38e261beaafdc94325785cc7c5 Mon Sep 17 00:00:00 2001 From: Ruben Dario Ponticelli Date: Wed, 5 Nov 2014 20:52:27 -0300 Subject: [PATCH] Add a locking mechanism to IsInitialBlockDownload to ensure it never goes from false to true. --- src/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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;