Skip to content

Commit

Permalink
Merge #2147: [RPC] fix getbalance transparent watch-only amount.
Browse files Browse the repository at this point in the history
bf14b97 [RPC] fix getbalance transparent watch-only amount. (furszy)

Pull request description:

  Fixing an issue with `getbalance`, which at the moment is not including the transparent watch-only balance.

  `getbalance` includes or not the shield balance, it will never return the shield balance only as the modified if/else block was doing. To get every specific balance type separately we use `getwalletinfo`.

ACKs for top commit:
  random-zebra:
    nice catch. utACK bf14b97
  Fuzzbawls:
    ACK bf14b97

Tree-SHA512: 9ff9caad0103f90d21df714c65e331fd2cc49688293979b9904cb13902fad70c7fe36bd1e5a46f09f49444340a9c0dc8e52f5867e17fa6679e9c14a7f884cad4
  • Loading branch information
random-zebra committed Jan 20, 2021
2 parents b777dc8 + bf14b97 commit 3f5d052
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1983,7 +1983,7 @@ UniValue getbalance(const JSONRPCRequest& request)
bool fIncludeShielded = paramsSize <= 3 || request.params[3].get_bool();

isminefilter filter = ISMINE_SPENDABLE | (fIncludeWatchOnly ?
(fIncludeShielded ? ISMINE_WATCH_ONLY_SHIELDED : ISMINE_WATCH_ONLY) : ISMINE_NO);
(fIncludeShielded ? ISMINE_WATCH_ONLY_ALL : ISMINE_WATCH_ONLY) : ISMINE_NO);
filter |= fIncludeDelegated ? ISMINE_SPENDABLE_DELEGATED : ISMINE_NO;
filter |= fIncludeShielded ? ISMINE_SPENDABLE_SHIELDED : ISMINE_NO;
return ValueFromAmount(pwalletMain->GetAvailableBalance(filter, true, nMinDepth));
Expand Down

0 comments on commit 3f5d052

Please sign in to comment.