HomePhabricator

Merge #14885: rpc: Assert named arguments are unique in RPCHelpMan

Description

Merge #14885: rpc: Assert named arguments are unique in RPCHelpMan

Summary:
e09a5875ca rpc: Assert named arguments are unique in RPCHelpMan (João Barbosa)

Pull request description:

Prevents an obvious mistake.

Tree-SHA512: 32c24a1934b17ab6f0d5cd31bdf0388e93ee5156ccc1b4f78eb9fd7f1d4b27a4b978b594ff11812bc9f20987c9fc36bf4497ddaedf18cf6bcbea19c050571334

Backport of Core PR14885

Depends on D5746

Test Plan:

ninja
./bitcoind
mkdir internalerror
./bitcoin-cli help > RPCs
./getrpchelps.sh RPCs internalerror
grep -rnI Internal\ error internalerror

The grep command's output should be empty.

Script:

Change the name of an argument for an RPC to be the same as another
i.e. waitforblock in rpc/blockchain.cpp from

{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false,

to

 {"timeout", RPCArg::Type::STR_HEX, /* opt */ false,
ninja
./bitcoind
./bitcoin-cli help waitforblock

Confirm bitcoind does not crash and that bitcoin-cli outputs the following error:

Internal bug detected: 'named_args.insert(arg.m_name).second'
You may report this issue here: https://github.com/Bitcoin-ABC/bitcoin-abc/issues

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

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien, deadalnix

Subscribers: deadalnix, Fabien

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

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Dec 10 2018, 15:26
nakihitoCommitted on Apr 20 2020, 17:12
deadalnixPushed on Apr 20 2020, 17:48
Reviewer
Restricted Owners Package
Differential Revision
D5586: Merge #14885: rpc: Assert named arguments are unique in RPCHelpMan
Parents
rSTAGINGf7690c0f382b: Merge #17192: util: Add CHECK_NONFATAL and use it in src/rpc
Branches
Unknown
Tags
Unknown
References
tag: phabricator/base/18967