Merge #18531: rpc: remove deprecated CRPCCommand constructor

faaf9c58e4 remove CRPCCommand constructor that takes rpcfn_type function pointer (MarcoFalke)
fa19bb2cd8 remove dead rpc code (MarcoFalke)

Pull request description:

  Remove the CRPCCommand arguments, now that they are asserted to be equal and thus redundant

  ### 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 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:
    tested ACK faaf9c58e4
  promag:
    Tested ACK faaf9c58e4.
  ryanofsky:
    Code review ACK faaf9c58e4. Two obviously good simplifications.

Tree-SHA512: 5de3b440f7b2ed2c3e86655d4f0e2e5df9c67e8ce3c7817d5ea5311d1a38690f2f3e28fab41aad6936be9fc884326d037e5f19e85d4d2fe281474dada13911ee
This commit is contained in:
MarcoFalke
2020-11-19 14:18:56 +01:00
6 changed files with 20 additions and 51 deletions

View File

@@ -14,17 +14,26 @@
#include <QDir>
#include <QtGlobal>
static UniValue rpcNestedTest_rpc(const JSONRPCRequest& request)
static RPCHelpMan rpcNestedTest_rpc()
{
if (request.fHelp) {
return "help message";
}
return request.params.write(0, 0);
return RPCHelpMan{
"rpcNestedTest",
"echo the passed string(s)",
{
{"arg1", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
{"arg2", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
{"arg3", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
},
{},
RPCExamples{""},
[](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue {
return request.params.write(0, 0);
},
};
}
static const CRPCCommand vRPCCommands[] =
{
{ "test", "rpcNestedTest", &rpcNestedTest_rpc, {} },
static const CRPCCommand vRPCCommands[] = {
{"test", "rpcNestedTest", &rpcNestedTest_rpc, {"arg1", "arg2", "arg3"}},
};
void RPCNestedTests::rpcNestedTests()