Skip to content
Permalink
Browse files

Add a locking mechanism to IsInitialBlockDownload to ensure it never …

…goes from false to true.
  • Loading branch information...
rdponticelli committed Nov 5, 2014
1 parent a2d0fc6 commit 9ec75c5ef4182a38e261beaafdc94325785cc7c5
Showing with 7 additions and 1 deletion.
  1. +7 −1 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;

0 comments on commit 9ec75c5

Please sign in to comment.
You can’t perform that action at this time.