From e84f393571160ce6f747eace3974b8aae3029ef2 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Tue, 22 Nov 2016 00:40:56 +0400 Subject: [PATCH] more info in getpoolinfo rpc, privatesend rpc should only do actions (#1154) --- src/darksend.cpp | 13 +++++++++++++ src/darksend.h | 1 + src/rpcmasternode.cpp | 34 ++++++++++++++++++---------------- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/darksend.cpp b/src/darksend.cpp index 04d11ae38..7f1b76dc0 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -491,6 +491,19 @@ void CDarksendPool::UnlockCoins() vecOutPointLocked.clear(); } +std::string CDarksendPool::GetStateString() const +{ + switch(nState) { + case POOL_STATE_IDLE: return "IDLE"; + case POOL_STATE_QUEUE: return "QUEUE"; + case POOL_STATE_ACCEPTING_ENTRIES: return "ACCEPTING_ENTRIES"; + case POOL_STATE_SIGNING: return "SIGNING"; + case POOL_STATE_ERROR: return "ERROR"; + case POOL_STATE_SUCCESS: return "SUCCESS"; + default: return "UNKNOWN"; + } +} + std::string CDarksendPool::GetStatus() { static int nStatusMessageProgress = 0; diff --git a/src/darksend.h b/src/darksend.h index c14f86f1f..549d74989 100644 --- a/src/darksend.h +++ b/src/darksend.h @@ -461,6 +461,7 @@ public: int GetQueueSize() const { return vecDarksendQueue.size(); } int GetState() const { return nState; } + std::string GetStateString() const; std::string GetStatus(); int GetEntriesCount() const { return vecEntries.size(); } diff --git a/src/rpcmasternode.cpp b/src/rpcmasternode.cpp index cc10ee166..666bc78ab 100644 --- a/src/rpcmasternode.cpp +++ b/src/rpcmasternode.cpp @@ -32,7 +32,6 @@ UniValue privatesend(const UniValue& params, bool fHelp) " start - Start mixing\n" " stop - Stop mixing\n" " reset - Reset mixing\n" - " status - Print mixing status\n" + HelpRequiringPassphrase()); if(params[0].get_str() == "start") { @@ -57,15 +56,6 @@ UniValue privatesend(const UniValue& params, bool fHelp) return "Mixing was reset"; } - if(params[0].get_str() == "status") { - UniValue obj(UniValue::VOBJ); - obj.push_back(Pair("status", darkSendPool.GetStatus())); - obj.push_back(Pair("keys_left", pwalletMain->nKeysLeftSinceAutoBackup)); - obj.push_back(Pair("warnings", (pwalletMain->nKeysLeftSinceAutoBackup < PRIVATESEND_KEYS_THRESHOLD_WARNING - ? "WARNING: keypool is almost depleted!" : ""))); - return obj; - } - return "Unknown command, please see \"help privatesend\""; } @@ -74,14 +64,26 @@ UniValue getpoolinfo(const UniValue& params, bool fHelp) if (fHelp || params.size() != 0) throw std::runtime_error( "getpoolinfo\n" - "Returns an object containing anonymous pool-related information."); + "Returns an object containing mixing pool related information.\n"); UniValue obj(UniValue::VOBJ); - if (darkSendPool.pSubmittedToMasternode) - obj.push_back(Pair("masternode", darkSendPool.pSubmittedToMasternode->addr.ToString())); - obj.push_back(Pair("queue", darkSendPool.GetQueueSize())); - obj.push_back(Pair("state", darkSendPool.GetState())); - obj.push_back(Pair("entries", darkSendPool.GetEntriesCount())); + obj.push_back(Pair("state", darkSendPool.GetStateString())); + obj.push_back(Pair("mixing_mode", fPrivateSendMultiSession ? "multi-session" : "normal")); + obj.push_back(Pair("queue", darkSendPool.GetQueueSize())); + obj.push_back(Pair("entries", darkSendPool.GetEntriesCount())); + obj.push_back(Pair("status", darkSendPool.GetStatus())); + + if (darkSendPool.pSubmittedToMasternode) { + obj.push_back(Pair("outpoint", darkSendPool.pSubmittedToMasternode->vin.prevout.ToStringShort())); + obj.push_back(Pair("addr", darkSendPool.pSubmittedToMasternode->addr.ToString())); + } + + if (pwalletMain) { + obj.push_back(Pair("keys_left", pwalletMain->nKeysLeftSinceAutoBackup)); + obj.push_back(Pair("warnings", pwalletMain->nKeysLeftSinceAutoBackup < PRIVATESEND_KEYS_THRESHOLD_WARNING + ? "WARNING: keypool is almost depleted!" : "")); + } + return obj; }