diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index ad8fba8d66dad..3693e606f8a08 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -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()) { @@ -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());