From 04f9b21cfe5f30727c70d8692dce07ba836dd472 Mon Sep 17 00:00:00 2001 From: lateminer Date: Fri, 22 Mar 2019 23:51:12 +0300 Subject: [PATCH] RPC: show total balance in getwalletinfo --- src/rpc/misc.cpp | 10 +++++----- src/wallet/rpcwallet.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 799b4079f..a3b7e2650 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -51,15 +51,15 @@ UniValue getinfo(const UniValue& params, bool fHelp) " \"version\": xxxxx, (numeric) the server version\n" " \"protocolversion\": xxxxx, (numeric) the protocol version\n" " \"walletversion\": xxxxx, (numeric) the wallet version\n" - " \"balance\": xxxxxxx, (numeric) the total bitcoin balance of the wallet\n" + " \"balance\": xxxxxxx, (numeric) the total confirmed balance of the wallet\n" " \"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n" " \"timeoffset\": xxxxx, (numeric) the time offset\n" " \"connections\": xxxxx, (numeric) the number of connections\n" " \"proxy\": \"host:port\", (string, optional) the proxy used by the server\n" - " \"difficulty\": { (json object)\n" - " \"proof-of-work\": xxxxxx, (numeric) the current proof-of-work difficulty\n" - " \"proof-of-stake\": xxxxxx (numeric) the current proof-of-stake difficulty\n" - " },\n" + " \"difficulty\": { (json object)\n" + " \"proof-of-work\": xxxxxx, (numeric) the current proof-of-work difficulty\n" + " \"proof-of-stake\": xxxxxx (numeric) the current proof-of-stake difficulty\n" + " },\n" " \"testnet\": true|false, (boolean) if the server is using testnet or not\n" " \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since Unix epoch) of the oldest pre-generated key in the key pool\n" " \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n" diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 2087ada1b..85a516c29 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2265,8 +2265,9 @@ UniValue getwalletinfo(const UniValue& params, bool fHelp) "\nResult:\n" "{\n" " \"walletversion\": xxxxx, (numeric) the wallet version\n" + " \"total_balance\": xxxxxxx, (numeric) the total balance of the wallet in " + CURRENCY_UNIT + "\n" " \"balance\": xxxxxxx, (numeric) the total confirmed balance of the wallet in " + CURRENCY_UNIT + "\n" - " \"stake\": xxxxxx, (numeric) the total coins staked (non-spendable until maturity) in " + CURRENCY_UNIT + "\n" + " \"staked_balance\": xxxxxx, (numeric) the total staked balance of the wallet in " + CURRENCY_UNIT + "\n" " \"unconfirmed_balance\": xxx, (numeric) the total unconfirmed balance of the wallet in " + CURRENCY_UNIT + "\n" " \"immature_balance\": xxxxxx, (numeric) the total immature balance of the wallet in " + CURRENCY_UNIT + "\n" " \"txcount\": xxxxxxx, (numeric) the total number of transactions in the wallet\n" @@ -2285,8 +2286,9 @@ UniValue getwalletinfo(const UniValue& params, bool fHelp) UniValue obj(UniValue::VOBJ); obj.push_back(Pair("walletversion", pwalletMain->GetVersion())); + obj.push_back(Pair("total_balance", ValueFromAmount(pwalletMain->GetBalance() + pwalletMain->GetUnconfirmedBalance() + pwalletMain->GetImmatureBalance() + pwalletMain->GetStake()))); obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); - obj.push_back(Pair("stake", ValueFromAmount(pwalletMain->GetStake()))); + obj.push_back(Pair("staked_balance", ValueFromAmount(pwalletMain->GetStake()))); obj.push_back(Pair("unconfirmed_balance", ValueFromAmount(pwalletMain->GetUnconfirmedBalance()))); obj.push_back(Pair("immature_balance", ValueFromAmount(pwalletMain->GetImmatureBalance()))); obj.push_back(Pair("txcount", (int)pwalletMain->mapWallet.size()));