stop mining before completely synced, more info in rpc

This commit is contained in:
UdjinM6 2015-08-13 16:07:38 +03:00
parent e52809a031
commit ac488d70b9
4 changed files with 11 additions and 3 deletions

View File

@ -20,6 +20,7 @@
#include "wallet.h"
#endif
#include "masternode-payments.h"
#include "masternode-sync.h"
#include <boost/thread.hpp>
#include <boost/tuple/tuple.hpp>
@ -474,7 +475,7 @@ void static BitcoinMiner(CWallet *pwallet)
LOCK(cs_vNodes);
fvNodesEmpty = vNodes.empty();
}
if (!fvNodesEmpty && !IsInitialBlockDownload())
if (!fvNodesEmpty && masternodeSync.IsSynced())
break;
MilliSleep(1000);
} while (true);

View File

@ -19,6 +19,7 @@
#ifdef ENABLE_WALLET
#include "db.h"
#include "wallet.h"
#include "masternode-sync.h"
#endif
#include <stdint.h>
@ -442,8 +443,11 @@ Value getblocktemplate(const Array& params, bool fHelp)
if (vNodes.empty())
throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Dash is not connected!");
if (IsInitialBlockDownload())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Dash is downloading blocks...");
if (!masternodeSync.IsBlockchainSynced())
throw JSONRPCError(RPC_CLIENT_IN_BLOCKCHAIN_SYNC, "Dash is trying to sync blocks...");
if (!masternodeSync.IsSynced())
throw JSONRPCError(RPC_CLIENT_IN_ADDITIONAL_SYNC, "Dash is trying to sync additional data... Use 'mnsync status' to get more info.");
static unsigned int nTransactionsUpdatedLast;

View File

@ -123,6 +123,7 @@ Value mnsync(const Array& params, bool fHelp)
Object obj;
obj.push_back(Pair("IsBlockchainSynced", masternodeSync.IsBlockchainSynced()));
obj.push_back(Pair("IsSynced", masternodeSync.IsSynced()));
obj.push_back(Pair("lastMasternodeList", masternodeSync.lastMasternodeList));
obj.push_back(Pair("lastMasternodeWinner", masternodeSync.lastMasternodeWinner));
obj.push_back(Pair("lastBudgetItem", masternodeSync.lastBudgetItem));

View File

@ -63,6 +63,8 @@ enum RPCErrorCode
//! P2P client errors
RPC_CLIENT_NOT_CONNECTED = -9, //! Dash is not connected
RPC_CLIENT_IN_INITIAL_DOWNLOAD = -10, //! Still downloading initial blocks
RPC_CLIENT_IN_BLOCKCHAIN_SYNC = -110,//! Syncing blocks
RPC_CLIENT_IN_ADDITIONAL_SYNC = -111,//! Syncing additional data
RPC_CLIENT_NODE_ALREADY_ADDED = -23, //! Node is already added
RPC_CLIENT_NODE_NOT_ADDED = -24, //! Node has not been added before