Skip to content

Commit

Permalink
Use GetWatchOnlyBalance instead of GetLegacyBalance in getbalanc
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasschnelli committed Jun 27, 2018
1 parent 61cb9c8 commit 9bbd407
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/wallet/rpcwallet.cpp
Expand Up @@ -905,12 +905,11 @@ static UniValue getbalance(const JSONRPCRequest& request)
int nMinDepth = 1;
if (!minconf.isNull())
nMinDepth = minconf.get_int();
isminefilter filter = ISMINE_SPENDABLE;
if(!include_watchonly.isNull())
if(include_watchonly.get_bool())
filter = filter | ISMINE_WATCH_ONLY;

if (IsDeprecatedRPCEnabled("accounts")) {
isminefilter filter = ISMINE_SPENDABLE;
if(!include_watchonly.isNull())
if(include_watchonly.get_bool())
filter = filter | ISMINE_WATCH_ONLY;
const UniValue& account_value = request.params[0];

if (!account_value.isNull()) {
Expand All @@ -921,8 +920,8 @@ static UniValue getbalance(const JSONRPCRequest& request)
return ValueFromAmount(pwallet->GetLegacyBalance(filter, nMinDepth, account));
}

if (!minconf.isNull() || !include_watchonly.isNull() || account) {
return ValueFromAmount(pwallet->GetLegacyBalance(filter, nMinDepth, account));
if (!minconf.isNull() || !include_watchonly.isNull()) {
return ValueFromAmount(pwallet->GetWatchOnlyBalance(nMinDepth));
}
else {
return ValueFromAmount(pwallet->GetBalance());
Expand Down

0 comments on commit 9bbd407

Please sign in to comment.