Acquire lock to check for genesis block.

This commit is contained in:
Patrick Strateman
2016-05-16 20:33:32 -07:00
committed by lateminer
parent 1b6cba2d1f
commit c312b47cce

View File

@@ -1422,10 +1422,18 @@ bool AppInit2(Config& config, boost::thread_group& threadGroup, CScheduler& sche
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