HomePhabricator

rpc: Treat all args after a hidden arg as hidden as well

Description

rpc: Treat all args after a hidden arg as hidden as well

Summary:
This commit has no effect right now, but hardens the code for the future

PR description:

Motivation

RPCArg names in the rpc help are currently only used for documentation. However, in the future they could be used to teach the server the named arguments. Named arguments are currently registered by the CRPCCommands and duplicate the RPCArg names from the documentation. This redundancy is fragile, and has lead to errors in the past (despite having linters to catch those kind of errors). See section "bugs found" for a list of bugs that have been found as a result of the changes here.

Changes

The changes here add an assert in the CRPCCommand constructor that the RPCArg names are identical to the ones in the CRPCCommand.

This is a backport of core#19528 [1/4]
https://github.com/bitcoin/bitcoin/pull/19528/commits/fa459bdc87bbb050ca1c8d469023a96ed798540e

Depends on D10010

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Jul 15 2020, 17:45
PiRKCommitted on Sep 10 2021, 08:14
PiRKPushed on Sep 10 2021, 08:14
Reviewer
Restricted Project
Differential Revision
D10080: rpc: Treat all args after a hidden arg as hidden as well
Parents
rABCc6a3bec649b9: rpc: Update server to use new RPCHelpMan
Branches
Unknown
Tags
Unknown