HomePhabricator

Merge #11050: Avoid treating null RPC arguments different from missing arguments

Description

Merge #11050: Avoid treating null RPC arguments different from missing arguments

Summary:
745d2e3 Clean up getbalance RPC parameter handling (Russell Yanofsky)
fd5d71e Update developer notes after params.size() cleanup (Russell Yanofsky)
e067673 Avoid treating null RPC arguments different from missing arguments (Russell Yanofsky)
e666efc Get rid of redundant RPC params.size() checks (Russell Yanofsky)

Pull request description:

This is a followup to #10783.

- The first commit doesn't change behavior at all, just simplifies code.
- The second commit just changes RPC methods to treat null arguments the same as missing arguments instead of throwing type errors.
- The third commit updates developer notes after the cleanup.
- The forth commit does some additional code cleanup in `getbalance`.

Followup changes that should happen in future PRs:

- [ ] Replace uses of `.isTrue()` with calls to `.get_bool()` so numbers, objects, and strings cause type errors instead of being interpreted as false. https://github.com/bitcoin/bitcoin/pull/11050#discussion_r133850525
- [ ] Add braces around if statements. https://github.com/bitcoin/bitcoin/pull/11050#discussion_r133851133
- [ ] Maybe improve UniValue type error exceptions and eliminate RPCTypeCheck and RPCTypeCheckArgument functions. https://github.com/bitcoin/bitcoin/pull/11050#discussion_r133829303

Tree-SHA512: e72f696011d20acc0778e996659e41f9426bffce387b29ff63bf59ad1163d5146761e4445b2b9b9e069a80596a57c7f4402b75a15d5d20f69f775ae558cf67e9

Backport of Core PR11050
https://github.com/bitcoin/bitcoin/pull/11050/

Depends on D3464

Test Plan:

make check
test_runner.py

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: Fabien, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3997

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Aug 22 2017, 07:24
nakihitoCommitted on Oct 17 2019, 18:19
nakihitoPushed on Oct 17 2019, 18:23
Reviewer
Restricted Owners Package
Differential Revision
D3997: Merge #11050: Avoid treating null RPC arguments different from missing arguments
Parents
rSTAGINGbe32cf1c6cd2: Merge #11191: RPC: Improve help text and behavior of RPC-logging.
Branches
Unknown
Tags
Unknown
References
tag: phabricator/base/13596