Masternode Sync should be finished before mining processing (#1240)

* Reject getblocktemplate request until masternode sync is finished

* Pending internal miner until masternode sync is finished
This commit is contained in:
TheLazieR Yip 2017-01-01 17:18:33 +07:00 committed by UdjinM6
parent 89d14c5274
commit 471365bf6c
2 changed files with 5 additions and 1 deletions

View File

@ -25,6 +25,7 @@
#include "util.h"
#include "utilmoneystr.h"
#include "masternode-payments.h"
#include "masternode-sync.h"
#include "validationinterface.h"
#include <boost/thread.hpp>
@ -422,7 +423,7 @@ void static BitcoinMiner(const CChainParams& chainparams)
LOCK(cs_vNodes);
fvNodesEmpty = vNodes.empty();
}
if (!fvNodesEmpty && !IsInitialBlockDownload())
if (!fvNodesEmpty && !IsInitialBlockDownload() && masternodeSync.IsSynced())
break;
MilliSleep(1000);
} while (true);

View File

@ -463,6 +463,9 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
if (IsInitialBlockDownload())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Dash Core is downloading blocks...");
if (!masternodeSync.IsSynced())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Dash Core is syncing with network...");
static unsigned int nTransactionsUpdatedLast;
if (!lpval.isNull())