From 93afebeef43597610ef8bad66c1ae1c9e69926b7 Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Sat, 30 May 2020 12:18:43 -0300 Subject: [PATCH] add new parameters to rpc client and fix some bugs --- qa/rpc-tests/wallet.py | 2 +- src/rpc/client.cpp | 4 ++++ src/wallet/rpcwallet.cpp | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/qa/rpc-tests/wallet.py b/qa/rpc-tests/wallet.py index 4e2d157e1..fb3238460 100755 --- a/qa/rpc-tests/wallet.py +++ b/qa/rpc-tests/wallet.py @@ -282,7 +282,7 @@ class WalletTest (BitcoinTestFramework): assert_equal(mybalance, Decimal('10.0')) # check integer balances from z_getbalance - assert_equal(self.nodes[2].z_getbalance(mytaddr, 1, True), 10) + assert_equal(self.nodes[2].z_getbalance(mytaddr, 1, True), 1000000000) mytxdetails = self.nodes[2].gettransaction(mytxid) myvjoinsplits = mytxdetails["vjoinsplit"] diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index fe084b8f2..4887d0555 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -37,7 +37,9 @@ static const CRPCConvertParam vRPCConvertParams[] = { "sendtoaddress", 4 }, { "settxfee", 0 }, { "getreceivedbyaddress", 1 }, + { "getreceivedbyaddress", 2 }, { "getreceivedbyaccount", 1 }, + { "getreceivedbyaccount", 2 }, { "listreceivedbyaddress", 0 }, { "listreceivedbyaddress", 1 }, { "listreceivedbyaddress", 2 }, @@ -46,6 +48,7 @@ static const CRPCConvertParam vRPCConvertParams[] = { "listreceivedbyaccount", 2 }, { "getbalance", 1 }, { "getbalance", 2 }, + { "getbalance", 3 }, { "getblockhash", 0 }, { "move", 2 }, { "move", 3 }, @@ -125,6 +128,7 @@ static const CRPCConvertParam vRPCConvertParams[] = { "z_listunspent", 2 }, { "z_listunspent", 3 }, { "z_getbalance", 1}, + { "z_getbalance", 2}, { "z_gettotalbalance", 0}, { "z_gettotalbalance", 1}, { "z_gettotalbalance", 2}, diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 786202b36..b954598b9 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -829,6 +829,10 @@ UniValue getbalance(const UniValue& params, bool fHelp) CAmount nBalance = GetAccountBalance(strAccount, nMinDepth, filter); + if (params.size() > 3 && params[3].get_bool()) { + return nBalance; + } + return ValueFromAmount(nBalance); } @@ -3541,7 +3545,7 @@ UniValue z_getbalance(const UniValue& params, bool fHelp) } // inZat - if (params.size() > 3 && params[3].get_bool()) { + if (params.size() > 2 && params[2].get_bool()) { return nBalance; }