Skip to content

Commit fa04f9b

Browse files
author
MarcoFalke
committed
rpc: Remove duplicate name and argNames from CRPCCommand
1 parent fa92912 commit fa04f9b

File tree

10 files changed

+175
-177
lines changed

10 files changed

+175
-177
lines changed

src/qt/test/rpcnestedtests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static RPCHelpMan rpcNestedTest_rpc()
3333
}
3434

3535
static const CRPCCommand vRPCCommands[] = {
36-
{"test", "rpcNestedTest", &rpcNestedTest_rpc, {"arg1", "arg2", "arg3"}},
36+
{"test", &rpcNestedTest_rpc},
3737
};
3838

3939
void RPCNestedTests::rpcNestedTests()

src/rpc/blockchain.cpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,41 +2480,41 @@ void RegisterBlockchainRPCCommands(CRPCTable &t)
24802480
{
24812481
// clang-format off
24822482
static const CRPCCommand commands[] =
2483-
{ // category name actor (function) argNames
2484-
// --------------------- ------------------------ ----------------------- ----------
2485-
{ "blockchain", "getblockchaininfo", &getblockchaininfo, {} },
2486-
{ "blockchain", "getchaintxstats", &getchaintxstats, {"nblocks", "blockhash"} },
2487-
{ "blockchain", "getblockstats", &getblockstats, {"hash_or_height", "stats"} },
2488-
{ "blockchain", "getbestblockhash", &getbestblockhash, {} },
2489-
{ "blockchain", "getblockcount", &getblockcount, {} },
2490-
{ "blockchain", "getblock", &getblock, {"blockhash","verbosity|verbose"} },
2491-
{ "blockchain", "getblockhash", &getblockhash, {"height"} },
2492-
{ "blockchain", "getblockheader", &getblockheader, {"blockhash","verbose"} },
2493-
{ "blockchain", "getchaintips", &getchaintips, {} },
2494-
{ "blockchain", "getdifficulty", &getdifficulty, {} },
2495-
{ "blockchain", "getmempoolancestors", &getmempoolancestors, {"txid","verbose"} },
2496-
{ "blockchain", "getmempooldescendants", &getmempooldescendants, {"txid","verbose"} },
2497-
{ "blockchain", "getmempoolentry", &getmempoolentry, {"txid"} },
2498-
{ "blockchain", "getmempoolinfo", &getmempoolinfo, {} },
2499-
{ "blockchain", "getrawmempool", &getrawmempool, {"verbose", "mempool_sequence"} },
2500-
{ "blockchain", "gettxout", &gettxout, {"txid","n","include_mempool"} },
2501-
{ "blockchain", "gettxoutsetinfo", &gettxoutsetinfo, {"hash_type"} },
2502-
{ "blockchain", "pruneblockchain", &pruneblockchain, {"height"} },
2503-
{ "blockchain", "savemempool", &savemempool, {} },
2504-
{ "blockchain", "verifychain", &verifychain, {"checklevel","nblocks"} },
2505-
2506-
{ "blockchain", "preciousblock", &preciousblock, {"blockhash"} },
2507-
{ "blockchain", "scantxoutset", &scantxoutset, {"action", "scanobjects"} },
2508-
{ "blockchain", "getblockfilter", &getblockfilter, {"blockhash", "filtertype"} },
2483+
{ // category actor (function)
2484+
// --------------------- ------------------------
2485+
{ "blockchain", &getblockchaininfo, },
2486+
{ "blockchain", &getchaintxstats, },
2487+
{ "blockchain", &getblockstats, },
2488+
{ "blockchain", &getbestblockhash, },
2489+
{ "blockchain", &getblockcount, },
2490+
{ "blockchain", &getblock, },
2491+
{ "blockchain", &getblockhash, },
2492+
{ "blockchain", &getblockheader, },
2493+
{ "blockchain", &getchaintips, },
2494+
{ "blockchain", &getdifficulty, },
2495+
{ "blockchain", &getmempoolancestors, },
2496+
{ "blockchain", &getmempooldescendants, },
2497+
{ "blockchain", &getmempoolentry, },
2498+
{ "blockchain", &getmempoolinfo, },
2499+
{ "blockchain", &getrawmempool, },
2500+
{ "blockchain", &gettxout, },
2501+
{ "blockchain", &gettxoutsetinfo, },
2502+
{ "blockchain", &pruneblockchain, },
2503+
{ "blockchain", &savemempool, },
2504+
{ "blockchain", &verifychain, },
2505+
2506+
{ "blockchain", &preciousblock, },
2507+
{ "blockchain", &scantxoutset, },
2508+
{ "blockchain", &getblockfilter, },
25092509

25102510
/* Not shown in help */
2511-
{ "hidden", "invalidateblock", &invalidateblock, {"blockhash"} },
2512-
{ "hidden", "reconsiderblock", &reconsiderblock, {"blockhash"} },
2513-
{ "hidden", "waitfornewblock", &waitfornewblock, {"timeout"} },
2514-
{ "hidden", "waitforblock", &waitforblock, {"blockhash","timeout"} },
2515-
{ "hidden", "waitforblockheight", &waitforblockheight, {"height","timeout"} },
2516-
{ "hidden", "syncwithvalidationinterfacequeue", &syncwithvalidationinterfacequeue, {} },
2517-
{ "hidden", "dumptxoutset", &dumptxoutset, {"path"} },
2511+
{ "hidden", &invalidateblock, },
2512+
{ "hidden", &reconsiderblock, },
2513+
{ "hidden", &waitfornewblock, },
2514+
{ "hidden", &waitforblock, },
2515+
{ "hidden", &waitforblockheight, },
2516+
{ "hidden", &syncwithvalidationinterfacequeue, },
2517+
{ "hidden", &dumptxoutset, },
25182518
};
25192519
// clang-format on
25202520
for (const auto& c : commands) {

src/rpc/mining.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,24 +1232,24 @@ void RegisterMiningRPCCommands(CRPCTable &t)
12321232
{
12331233
// clang-format off
12341234
static const CRPCCommand commands[] =
1235-
{ // category name actor (function) argNames
1236-
// --------------------- ------------------------ ----------------------- ----------
1237-
{ "mining", "getnetworkhashps", &getnetworkhashps, {"nblocks","height"} },
1238-
{ "mining", "getmininginfo", &getmininginfo, {} },
1239-
{ "mining", "prioritisetransaction", &prioritisetransaction, {"txid","dummy","fee_delta"} },
1240-
{ "mining", "getblocktemplate", &getblocktemplate, {"template_request"} },
1241-
{ "mining", "submitblock", &submitblock, {"hexdata","dummy"} },
1242-
{ "mining", "submitheader", &submitheader, {"hexdata"} },
1235+
{ // category actor (function)
1236+
// --------------------- -----------------------
1237+
{ "mining", &getnetworkhashps, },
1238+
{ "mining", &getmininginfo, },
1239+
{ "mining", &prioritisetransaction, },
1240+
{ "mining", &getblocktemplate, },
1241+
{ "mining", &submitblock, },
1242+
{ "mining", &submitheader, },
12431243

12441244

1245-
{ "generating", "generatetoaddress", &generatetoaddress, {"nblocks","address","maxtries"} },
1246-
{ "generating", "generatetodescriptor", &generatetodescriptor, {"num_blocks","descriptor","maxtries"} },
1247-
{ "generating", "generateblock", &generateblock, {"output","transactions"} },
1245+
{ "generating", &generatetoaddress, },
1246+
{ "generating", &generatetodescriptor, },
1247+
{ "generating", &generateblock, },
12481248

1249-
{ "util", "estimatesmartfee", &estimatesmartfee, {"conf_target", "estimate_mode"} },
1249+
{ "util", &estimatesmartfee, },
12501250

1251-
{ "hidden", "estimaterawfee", &estimaterawfee, {"conf_target", "threshold"} },
1252-
{ "hidden", "generate", &generate, {} },
1251+
{ "hidden", &estimaterawfee, },
1252+
{ "hidden", &generate, },
12531253
};
12541254
// clang-format on
12551255
for (const auto& c : commands) {

src/rpc/misc.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -699,23 +699,23 @@ void RegisterMiscRPCCommands(CRPCTable &t)
699699
{
700700
// clang-format off
701701
static const CRPCCommand commands[] =
702-
{ // category name actor (function) argNames
703-
// --------------------- ------------------------ ----------------------- ----------
704-
{ "control", "getmemoryinfo", &getmemoryinfo, {"mode"} },
705-
{ "control", "logging", &logging, {"include", "exclude"}},
706-
{ "util", "validateaddress", &validateaddress, {"address"} },
707-
{ "util", "createmultisig", &createmultisig, {"nrequired","keys","address_type"} },
708-
{ "util", "deriveaddresses", &deriveaddresses, {"descriptor", "range"} },
709-
{ "util", "getdescriptorinfo", &getdescriptorinfo, {"descriptor"} },
710-
{ "util", "verifymessage", &verifymessage, {"address","signature","message"} },
711-
{ "util", "signmessagewithprivkey", &signmessagewithprivkey, {"privkey","message"} },
712-
{ "util", "getindexinfo", &getindexinfo, {"index_name"} },
702+
{ // category actor (function)
703+
// --------------------- ------------------------
704+
{ "control", &getmemoryinfo, },
705+
{ "control", &logging, },
706+
{ "util", &validateaddress, },
707+
{ "util", &createmultisig, },
708+
{ "util", &deriveaddresses, },
709+
{ "util", &getdescriptorinfo, },
710+
{ "util", &verifymessage, },
711+
{ "util", &signmessagewithprivkey, },
712+
{ "util", &getindexinfo, },
713713

714714
/* Not shown in help */
715-
{ "hidden", "setmocktime", &setmocktime, {"timestamp"}},
716-
{ "hidden", "mockscheduler", &mockscheduler, {"delta_time"}},
717-
{ "hidden", "echo", &echo, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}},
718-
{ "hidden", "echojson", &echojson, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}},
715+
{ "hidden", &setmocktime, },
716+
{ "hidden", &mockscheduler, },
717+
{ "hidden", &echo, },
718+
{ "hidden", &echojson, },
719719
};
720720
// clang-format on
721721
for (const auto& c : commands) {

src/rpc/net.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -941,24 +941,24 @@ void RegisterNetRPCCommands(CRPCTable &t)
941941
{
942942
// clang-format off
943943
static const CRPCCommand commands[] =
944-
{ // category name actor (function) argNames
945-
// --------------------- ------------------------ ----------------------- ----------
946-
{ "network", "getconnectioncount", &getconnectioncount, {} },
947-
{ "network", "ping", &ping, {} },
948-
{ "network", "getpeerinfo", &getpeerinfo, {} },
949-
{ "network", "addnode", &addnode, {"node","command"} },
950-
{ "network", "disconnectnode", &disconnectnode, {"address", "nodeid"} },
951-
{ "network", "getaddednodeinfo", &getaddednodeinfo, {"node"} },
952-
{ "network", "getnettotals", &getnettotals, {} },
953-
{ "network", "getnetworkinfo", &getnetworkinfo, {} },
954-
{ "network", "setban", &setban, {"subnet", "command", "bantime", "absolute"} },
955-
{ "network", "listbanned", &listbanned, {} },
956-
{ "network", "clearbanned", &clearbanned, {} },
957-
{ "network", "setnetworkactive", &setnetworkactive, {"state"} },
958-
{ "network", "getnodeaddresses", &getnodeaddresses, {"count"} },
959-
960-
{ "hidden", "addconnection", &addconnection, {"address", "connection_type"} },
961-
{ "hidden", "addpeeraddress", &addpeeraddress, {"address", "port"} },
944+
{ // category actor
945+
// --------------------- -----------------------
946+
{ "network", &getconnectioncount, },
947+
{ "network", &ping, },
948+
{ "network", &getpeerinfo, },
949+
{ "network", &addnode, },
950+
{ "network", &disconnectnode, },
951+
{ "network", &getaddednodeinfo, },
952+
{ "network", &getnettotals, },
953+
{ "network", &getnetworkinfo, },
954+
{ "network", &setban, },
955+
{ "network", &listbanned, },
956+
{ "network", &clearbanned, },
957+
{ "network", &setnetworkactive, },
958+
{ "network", &getnodeaddresses, },
959+
960+
{ "hidden", &addconnection, },
961+
{ "hidden", &addpeeraddress, },
962962
};
963963
// clang-format on
964964
for (const auto& c : commands) {

src/rpc/rawtransaction.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,27 +1859,27 @@ void RegisterRawTransactionRPCCommands(CRPCTable &t)
18591859
{
18601860
// clang-format off
18611861
static const CRPCCommand commands[] =
1862-
{ // category name actor (function) argNames
1863-
// --------------------- ------------------------ ----------------------- ----------
1864-
{ "rawtransactions", "getrawtransaction", &getrawtransaction, {"txid","verbose","blockhash"} },
1865-
{ "rawtransactions", "createrawtransaction", &createrawtransaction, {"inputs","outputs","locktime","replaceable"} },
1866-
{ "rawtransactions", "decoderawtransaction", &decoderawtransaction, {"hexstring","iswitness"} },
1867-
{ "rawtransactions", "decodescript", &decodescript, {"hexstring"} },
1868-
{ "rawtransactions", "sendrawtransaction", &sendrawtransaction, {"hexstring","maxfeerate"} },
1869-
{ "rawtransactions", "combinerawtransaction", &combinerawtransaction, {"txs"} },
1870-
{ "rawtransactions", "signrawtransactionwithkey", &signrawtransactionwithkey, {"hexstring","privkeys","prevtxs","sighashtype"} },
1871-
{ "rawtransactions", "testmempoolaccept", &testmempoolaccept, {"rawtxs","maxfeerate"} },
1872-
{ "rawtransactions", "decodepsbt", &decodepsbt, {"psbt"} },
1873-
{ "rawtransactions", "combinepsbt", &combinepsbt, {"txs"} },
1874-
{ "rawtransactions", "finalizepsbt", &finalizepsbt, {"psbt", "extract"} },
1875-
{ "rawtransactions", "createpsbt", &createpsbt, {"inputs","outputs","locktime","replaceable"} },
1876-
{ "rawtransactions", "converttopsbt", &converttopsbt, {"hexstring","permitsigdata","iswitness"} },
1877-
{ "rawtransactions", "utxoupdatepsbt", &utxoupdatepsbt, {"psbt", "descriptors"} },
1878-
{ "rawtransactions", "joinpsbts", &joinpsbts, {"txs"} },
1879-
{ "rawtransactions", "analyzepsbt", &analyzepsbt, {"psbt"} },
1880-
1881-
{ "blockchain", "gettxoutproof", &gettxoutproof, {"txids", "blockhash"} },
1882-
{ "blockchain", "verifytxoutproof", &verifytxoutproof, {"proof"} },
1862+
{ // category actor (function)
1863+
// --------------------- -----------------------
1864+
{ "rawtransactions", &getrawtransaction, },
1865+
{ "rawtransactions", &createrawtransaction, },
1866+
{ "rawtransactions", &decoderawtransaction, },
1867+
{ "rawtransactions", &decodescript, },
1868+
{ "rawtransactions", &sendrawtransaction, },
1869+
{ "rawtransactions", &combinerawtransaction, },
1870+
{ "rawtransactions", &signrawtransactionwithkey, },
1871+
{ "rawtransactions", &testmempoolaccept, },
1872+
{ "rawtransactions", &decodepsbt, },
1873+
{ "rawtransactions", &combinepsbt, },
1874+
{ "rawtransactions", &finalizepsbt, },
1875+
{ "rawtransactions", &createpsbt, },
1876+
{ "rawtransactions", &converttopsbt, },
1877+
{ "rawtransactions", &utxoupdatepsbt, },
1878+
{ "rawtransactions", &joinpsbts, },
1879+
{ "rawtransactions", &analyzepsbt, },
1880+
1881+
{ "blockchain", &gettxoutproof, },
1882+
{ "blockchain", &verifytxoutproof, },
18831883
};
18841884
// clang-format on
18851885
for (const auto& c : commands) {

src/rpc/server.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,13 @@ static RPCHelpMan getrpcinfo()
249249

250250
// clang-format off
251251
static const CRPCCommand vRPCCommands[] =
252-
{ // category name actor (function) argNames
253-
// --------------------- ------------------------ ----------------------- ----------
252+
{ // category actor (function)
253+
// --------------------- -----------------------
254254
/* Overall control/query calls */
255-
{ "control", "getrpcinfo", &getrpcinfo, {} },
256-
{ "control", "help", &help, {"command"} },
257-
{ "control", "stop", &stop, {"wait"} },
258-
{ "control", "uptime", &uptime, {} },
255+
{ "control", &getrpcinfo, },
256+
{ "control", &help, },
257+
{ "control", &stop, },
258+
{ "control", &uptime, },
259259
};
260260
// clang-format on
261261

src/rpc/server.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,14 @@ class CRPCCommand
103103
}
104104

105105
//! Simplified constructor taking plain RpcMethodFnType function pointer.
106-
CRPCCommand(std::string category, std::string name_in, RpcMethodFnType fn, std::vector<std::string> args_in)
106+
CRPCCommand(std::string category, RpcMethodFnType fn)
107107
: CRPCCommand(
108108
category,
109109
fn().m_name,
110110
[fn](const JSONRPCRequest& request, UniValue& result, bool) { result = fn().HandleRequest(request); return true; },
111111
fn().GetArgNames(),
112112
intptr_t(fn))
113113
{
114-
CHECK_NONFATAL(fn().m_name == name_in);
115-
CHECK_NONFATAL(fn().GetArgNames() == args_in);
116114
}
117115

118116
std::string category;

0 commit comments

Comments
 (0)