0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-05 10:17:30 -05:00
bitcoin-bitcoin-core/src/rpc
MarcoFalke d692d192cd
Merge #19849: Assert that RPCArg names are equal to CRPCCommand ones (blockchain,rawtransaction)
fa6bb0ce5d Assert that RPCArg names are equal to CRPCCommand ones (rawtransaction) (MarcoFalke)
fa80c81487 Assert that RPCArg names are equal to CRPCCommand ones (blockchain) (MarcoFalke)

Pull request description:

  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 `CRPCCommand`s 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`.

  ### Future work

  > Here or follow up, makes sense to also assert type of returned UniValue?

  Sure, but let's not get ahead of ourselves. I am going to submit any further works as follow-ups, including:

  * Removing the CRPCCommand arguments, now that they are asserted to be equal and thus redundant
  * Removing all python regex linters on the args, now that RPCMan can be used to generate any output, including the cli.cpp table
  * Auto-formatting and sanity checking the RPCExamples with RPCMan
  * Checking passed-in json in self-check. Removing redundant checks
  * Checking returned json against documentation to avoid regressions or false documentation
  * Compile the RPC documentation at compile-time to ensure it doesn't change at runtime and is completely static

  ### Bugs found

  * The assert identified issue #18607
  * The changes itself fixed bug #19250

ACKs for top commit:
  fjahr:
    utACK fa6bb0ce5d
  tryphe:
    utACK fa6bb0ce5d. Reducing data duplication is nice. Code changes are minimal and concise.

Tree-SHA512: deb0edc3f999baf055526eaa199b98c500635e12502dece7aa3cad5319db330eb5ee7459a5c8f040a83671a7f20c560c19a2026fb76c8416f138aa332727cbce
2020-09-22 17:08:08 +02:00
..
blockchain.cpp Merge #19849: Assert that RPCArg names are equal to CRPCCommand ones (blockchain,rawtransaction) 2020-09-22 17:08:08 +02:00
blockchain.h validation: Make ProcessNewBlock*() members of ChainstateManager 2020-05-21 09:56:16 -04:00
client.cpp [rpc] add send method 2020-09-10 13:44:53 +02:00
client.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
mining.cpp Merge #19717: rpc: Assert that RPCArg names are equal to CRPCCommand ones (mining,zmq,rpcdump) 2020-08-31 17:43:35 +02:00
mining.h rpc: create rpc/mining.h, hoist default max tries values to constant 2020-06-01 15:08:36 +02:00
misc.cpp rpc: Add getindexinfo RPC 2020-08-16 11:15:49 +02:00
net.cpp Merge #19405: rpc, cli: add network in/out connections to getnetworkinfo and -getinfo 2020-09-04 15:09:37 +02:00
protocol.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
rawtransaction.cpp Merge #19849: Assert that RPCArg names are equal to CRPCCommand ones (blockchain,rawtransaction) 2020-09-22 17:08:08 +02:00
rawtransaction_util.cpp [rpc] walletcreatefundedpsbt: allow inputs to be null 2020-09-07 20:33:16 +02:00
rawtransaction_util.h scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
register.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
request.cpp refactor: Make HexStr take a span 2020-08-06 19:41:43 +02:00
request.h Remove g_rpc_chain global 2020-05-28 02:13:19 -04:00
server.cpp rpc: Remove unused return type from appendCommand 2020-08-14 12:37:06 +02:00
server.h rpc: Remove unused return type from appendCommand 2020-08-14 12:37:06 +02:00
util.cpp Merge #19528: rpc: Assert that RPCArg names are equal to CRPCCommand ones (misc) 2020-08-14 09:26:37 +02:00
util.h Merge #19386: rpc: Assert that RPCArg names are equal to CRPCCommand ones (server) 2020-07-15 19:20:21 +02:00