Page MenuHomePhabricator

Assert that RPCArg names are equal to CRPCCommand ones (blockchain)
ClosedPublic

Authored by PiRK on Oct 11 2021, 12:55.

Details

Summary

This is split out from #18531 to just touch some RPC methods. Description from the main pr:
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#19849 [1/2]
https://github.com/bitcoin/bitcoin/pull/19849/commits/fa80c814874a2893e4323ba5148fba21d7f421cd

Test Plan

ninja all check-all

Event Timeline

PiRK requested review of this revision.Oct 11 2021, 12:55

remove accidental newline in blockchain.h

This revision is now accepted and ready to land.Oct 11 2021, 13:33
PiRK retitled this revision from Assert that RPCArg names are equal to CRPCCommand ones (blockchain) i to Assert that RPCArg names are equal to CRPCCommand ones (blockchain).Oct 12 2021, 13:17