From dcf020a886d73c3cdd6013c979fbc3761c3c11ac Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 31 Aug 2015 07:20:38 +0300 Subject: [PATCH] Rpc changes for missing masternodes: - show MN status in `masternode list-conf`, display MISSING if MN was not found in mn list - do not allow to run `start-missing` and `start-disabled` until mn list is synced --- src/rpcmasternode.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/rpcmasternode.cpp b/src/rpcmasternode.cpp index d0d105fb4..d59abb774 100644 --- a/src/rpcmasternode.cpp +++ b/src/rpcmasternode.cpp @@ -342,6 +342,12 @@ Value masternode(const Array& params, bool fHelp) } } + if((strCommand == "start-missing" || strCommand == "start-disabled") && + (masternodeSync.RequestedMasternodeAssets <= MASTERNODE_SYNC_LIST || + masternodeSync.RequestedMasternodeAssets == MASTERNODE_SYNC_FAILED)) { + throw runtime_error("You can't use this command until masternode list is synced\n"); + } + std::vector mnEntries; mnEntries = masternodeConfig.getEntries(); @@ -405,12 +411,18 @@ Value masternode(const Array& params, bool fHelp) Object resultObj; BOOST_FOREACH(CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) { + CTxIn vin = CTxIn(uint256(mne.getTxHash()), uint32_t(atoi(mne.getOutputIndex().c_str()))); + CMasternode *pmn = mnodeman.Find(vin); + + std::string strStatus = pmn ? pmn->Status() : "MISSING"; + Object mnObj; mnObj.push_back(Pair("alias", mne.getAlias())); mnObj.push_back(Pair("address", mne.getIp())); mnObj.push_back(Pair("privateKey", mne.getPrivKey())); mnObj.push_back(Pair("txHash", mne.getTxHash())); mnObj.push_back(Pair("outputIndex", mne.getOutputIndex())); + mnObj.push_back(Pair("status", strStatus)); resultObj.push_back(Pair("masternode", mnObj)); }