Skip to content

Commit faaf9c5

Browse files
author
MarcoFalke
committed
remove CRPCCommand constructor that takes rpcfn_type function pointer
1 parent fa19bb2 commit faaf9c5

File tree

3 files changed

+17
-38
lines changed

3 files changed

+17
-38
lines changed

src/qt/test/rpcnestedtests.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,26 @@
1414
#include <QDir>
1515
#include <QtGlobal>
1616

17-
static UniValue rpcNestedTest_rpc(const JSONRPCRequest& request)
17+
static RPCHelpMan rpcNestedTest_rpc()
1818
{
19-
return request.params.write(0, 0);
19+
return RPCHelpMan{
20+
"rpcNestedTest",
21+
"echo the passed string(s)",
22+
{
23+
{"arg1", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
24+
{"arg2", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
25+
{"arg3", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
26+
},
27+
{},
28+
RPCExamples{""},
29+
[](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue {
30+
return request.params.write(0, 0);
31+
},
32+
};
2033
}
2134

22-
static const CRPCCommand vRPCCommands[] =
23-
{
24-
{ "test", "rpcNestedTest", &rpcNestedTest_rpc, {} },
35+
static const CRPCCommand vRPCCommands[] = {
36+
{"test", "rpcNestedTest", &rpcNestedTest_rpc, {"arg1", "arg2", "arg3"}},
2537
};
2638

2739
void RPCNestedTests::rpcNestedTests()

src/rpc/server.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ void RPCUnsetTimerInterface(RPCTimerInterface *iface);
8585
*/
8686
void RPCRunLater(const std::string& name, std::function<void()> func, int64_t nSeconds);
8787

88-
typedef UniValue(*rpcfn_type)(const JSONRPCRequest& jsonRequest);
8988
typedef RPCHelpMan (*RpcMethodFnType)();
9089

9190
class CRPCCommand
@@ -116,14 +115,6 @@ class CRPCCommand
116115
CHECK_NONFATAL(fn().GetArgNames() == args_in);
117116
}
118117

119-
//! Simplified constructor taking plain rpcfn_type function pointer.
120-
CRPCCommand(const char* category, const char* name, rpcfn_type fn, std::initializer_list<const char*> args)
121-
: CRPCCommand(category, name,
122-
[fn](const JSONRPCRequest& request, UniValue& result, bool) { result = fn(request); return true; },
123-
{args.begin(), args.end()}, intptr_t(fn))
124-
{
125-
}
126-
127118
std::string category;
128119
std::string name;
129120
Actor actor;

test/lint/lint-rpc-help.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)