-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RPC] re introducing filtering args in getbalance #1831
[RPC] re introducing filtering args in getbalance #1831
Conversation
70c655c
to
8efb2c5
Compare
8efb2c5
to
37f0cd1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the removed argument, need to lower the size in the checks accordingly (see comments inlined).
btw, styling nit: could use a more compact syntax, like
const int paramsSize = request.params.size();
const int nMinDepth = (paramsSize > 0 ? request.params[0].get_int() : 0);
isminefilter filter = ISMINE_SPENDABLE | (paramsSize > 1 && request.params[1].get_bool() ? ISMINE_WATCH_ONLY : ISMINE_NO);
filter |= (paramsSize <= 2 || request.params[2].get_bool() ? ISMINE_SPENDABLE_DELEGATED : ISMINE_NO);
return ValueFromAmount(pwalletMain->GetAvailableBalance(filter, true, nMinDepth));
Also, the initial check for the help needs to be updated to
if (request.fHelp ||
(request.params.size() > 4 && IsDeprecatedRPCEnabled("accounts")) ||
(request.params.size() > 3 && !IsDeprecatedRPCEnabled("accounts")))
watch only, depth and includeDelegated arguments.
37f0cd1
to
35af377
Compare
yeah, great review zebra. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed on the need for more specific tests over getbalance
RPC.
utACK 35af377
Have re introduced the filtering arguments that were removed when the accounts system got deprecated in
getbalance
. With this,getbalance
RPC command will be able, again, to filter by watch-only, minimum depth and include/exclude delegated balance.