more info in getpoolinfo rpc, privatesend rpc should only do actions (#1154)

This commit is contained in:
UdjinM6 2016-11-22 00:40:56 +04:00 committed by GitHub
parent 785adad57e
commit e84f393571
3 changed files with 32 additions and 16 deletions

View File

@ -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;

View File

@ -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(); }

View File

@ -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;
}