Page MenuHomePhabricator

Assert that RPCArg names are equal to CRPCCommand ones (net, rpcwallet)
ClosedPublic

Authored by PiRK on Oct 14 2021, 09:52.

Details

Summary

This is the last part 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#19994

Depends on D10340

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK published this revision for review.Oct 14 2021, 13:09
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/rpc/net.cpp
266 ↗(On Diff #30537)

That's a good reminder

This revision is now accepted and ready to land.Oct 14 2021, 15:16
src/rpc/net.cpp
266 ↗(On Diff #30537)

Yes, I checked that there is an upcoming PR dealing with it, when I saw it: https://github.com/bitcoin/bitcoin/pull/20755