From de7d6a3e988d664b52e1c4039e0bb7f04c9b8bac Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Sat, 28 Mar 2015 20:32:53 +0300 Subject: [PATCH] Try to sync before start mining. --- src/miner.cpp | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 0f04521..aca0674 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -520,6 +520,8 @@ void StakeMiner(CWallet *pwallet) // Make this thread recognisable as the mining thread RenameThread("novacoin-miner"); + bool fTrySync = true; + // Each thread has its own counter unsigned int nExtraNonce = 0; @@ -537,11 +539,23 @@ void StakeMiner(CWallet *pwallet) while (vNodes.empty() || IsInitialBlockDownload()) { + fTrySync = true; + Sleep(1000); if (fShutdown) return; } + if (fTrySync) + { + fTrySync = false; + if (vNodes.size() < 3 || nBestHeight < GetNumBlocksOfPeers()) + { + Sleep(1000); + continue; + } + } + // // Create new block // -- 1.7.1