add new parameters to rpc client and fix some bugs

This commit is contained in:
Alfredo Garcia 2020-05-30 12:18:43 -03:00
parent e7c829aa0e
commit 93afebeef4
3 changed files with 10 additions and 2 deletions

View File

@ -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"]

View File

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

View File

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