diff options
| author | Patrick Strateman <[email protected]> | 2016-05-16 20:33:32 -0700 |
|---|---|---|
| committer | Patrick Strateman <[email protected]> | 2016-05-16 20:33:32 -0700 |
| commit | 46b0c3b688dccf6ba9ac08cbd6d6981249a73b1a (patch) | |
| tree | fcc3471f8fbbbcb08c44831e40bd7b36786ba7e1 /src/init.cpp | |
| parent | Merge #8059: Remove unneeded feerate param from RelayTransaction/AcceptToMemo... (diff) | |
| download | discoin-46b0c3b688dccf6ba9ac08cbd6d6981249a73b1a.tar.xz discoin-46b0c3b688dccf6ba9ac08cbd6d6981249a73b1a.zip | |
Acquire lock to check for genesis block.
Diffstat (limited to 'src/init.cpp')
| -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 d19ca530b..fd1241d93 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1371,10 +1371,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 |