Skip to content

Commit 471365b

Browse files
thelazierUdjinM6
authored andcommitted
Masternode Sync should be finished before mining processing (dashpay#1240)
* Reject getblocktemplate request until masternode sync is finished * Pending internal miner until masternode sync is finished
1 parent 89d14c5 commit 471365b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/miner.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "util.h"
2626
#include "utilmoneystr.h"
2727
#include "masternode-payments.h"
28+
#include "masternode-sync.h"
2829
#include "validationinterface.h"
2930

3031
#include <boost/thread.hpp>
@@ -422,7 +423,7 @@ void static BitcoinMiner(const CChainParams& chainparams)
422423
LOCK(cs_vNodes);
423424
fvNodesEmpty = vNodes.empty();
424425
}
425-
if (!fvNodesEmpty && !IsInitialBlockDownload())
426+
if (!fvNodesEmpty && !IsInitialBlockDownload() && masternodeSync.IsSynced())
426427
break;
427428
MilliSleep(1000);
428429
} while (true);

src/rpcmining.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
463463
if (IsInitialBlockDownload())
464464
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Dash Core is downloading blocks...");
465465

466+
if (!masternodeSync.IsSynced())
467+
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Dash Core is syncing with network...");
468+
466469
static unsigned int nTransactionsUpdatedLast;
467470

468471
if (!lpval.isNull())

0 commit comments

Comments
 (0)