diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2016-05-25 16:02:06 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2016-05-25 16:12:20 +0200 |
commit | c49c825bd9f4764536b45df5a684d97173673fc7 (patch) | |
tree | 490f54bb2eaeca742b455199394e9fb0525c7582 /src | |
parent | 33799afe83eec4200ff140e9bf5eae83701a4d7f (diff) | |
parent | 46b0c3b688dccf6ba9ac08cbd6d6981249a73b1a (diff) |
Merge #8063: Acquire lock to check for genesis block.
46b0c3b Acquire lock to check for genesis block. (Patrick Strateman)
Diffstat (limited to 'src')
-rw-r--r-- | src/init.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/init.cpp b/src/init.cpp index 8688381ecf..f95027410d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1373,10 +1373,18 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) vImportFiles.push_back(strFile); } threadGroup.create_thread(boost::bind(&ThreadImport, vImportFiles)); - if (chainActive.Tip() == NULL) { - LogPrintf("Waiting for genesis block to be imported...\n"); - while (!fRequestShutdown && chainActive.Tip() == NULL) + + // Wait for genesis block to be processed + bool fHaveGenesis = false; + while (!fHaveGenesis && !fRequestShutdown) { + { + LOCK(cs_main); + fHaveGenesis = (chainActive.Tip() != NULL); + } + + if (!fHaveGenesis) { MilliSleep(10); + } } // ********************************************************* Step 11: start node |