[RPC] re introducing filtering args in getbalance#1831
Merged
furszy merged 1 commit intoSep 7, 2020
Conversation
70c655c to
8efb2c5
Compare
8efb2c5 to
37f0cd1
Compare
random-zebra
reviewed
Sep 2, 2020
random-zebra
left a comment
There was a problem hiding this comment.
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
Author
|
yeah, great review zebra. |
random-zebra
approved these changes
Sep 3, 2020
random-zebra
left a comment
There was a problem hiding this comment.
Agreed on the need for more specific tests over getbalance RPC.
utACK 35af377
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Have re introduced the filtering arguments that were removed when the accounts system got deprecated in
getbalance. With this,getbalanceRPC command will be able, again, to filter by watch-only, minimum depth and include/exclude delegated balance.