Skip to content

Commit b8ebc59

Browse files
committed
rpc: Named arguments for net calls
Also add a more descriptive message for `setnetworkactive`.
1 parent 2ca9dcd commit b8ebc59

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/rpc/net.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,10 @@ UniValue setban(const JSONRPCRequest& request)
468468
if (request.fHelp || request.params.size() < 2 ||
469469
(strCommand != "add" && strCommand != "remove"))
470470
throw runtime_error(
471-
"setban \"ip(/netmask)\" \"add|remove\" (bantime) (absolute)\n"
471+
"setban \"subnet\" \"add|remove\" (bantime) (absolute)\n"
472472
"\nAttempts add or remove a IP/Subnet from the banned list.\n"
473473
"\nArguments:\n"
474-
"1. \"ip(/netmask)\" (string, required) The IP/Subnet (see getpeerinfo for nodes ip) with a optional netmask (default is /32 = single ip)\n"
474+
"1. \"subnet\" (string, required) The IP/Subnet (see getpeerinfo for nodes ip) with a optional netmask (default is /32 = single ip)\n"
475475
"2. \"command\" (string, required) 'add' to add a IP/Subnet to the list, 'remove' to remove a IP/Subnet from the list\n"
476476
"3. \"bantime\" (numeric, optional) time in seconds how long (or until when if [absolute] is set) the ip is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)\n"
477477
"4. \"absolute\" (boolean, optional) If set, the bantime must be a absolute timestamp in seconds since epoch (Jan 1 1970 GMT)\n"
@@ -580,7 +580,9 @@ UniValue setnetworkactive(const JSONRPCRequest& request)
580580
if (request.fHelp || request.params.size() != 1) {
581581
throw runtime_error(
582582
"setnetworkactive true|false\n"
583-
"Disable/enable all p2p network activity."
583+
"\nDisable/enable all p2p network activity.\n"
584+
"\nArguments:\n"
585+
"1. \"state\" (boolean, required) true to enable networking, false to disable\n"
584586
);
585587
}
586588

@@ -596,18 +598,18 @@ UniValue setnetworkactive(const JSONRPCRequest& request)
596598
static const CRPCCommand commands[] =
597599
{ // category name actor (function) okSafeMode
598600
// --------------------- ------------------------ ----------------------- ----------
599-
{ "network", "getconnectioncount", &getconnectioncount, true },
600-
{ "network", "ping", &ping, true },
601-
{ "network", "getpeerinfo", &getpeerinfo, true },
602-
{ "network", "addnode", &addnode, true },
603-
{ "network", "disconnectnode", &disconnectnode, true },
604-
{ "network", "getaddednodeinfo", &getaddednodeinfo, true },
605-
{ "network", "getnettotals", &getnettotals, true },
606-
{ "network", "getnetworkinfo", &getnetworkinfo, true },
607-
{ "network", "setban", &setban, true },
608-
{ "network", "listbanned", &listbanned, true },
609-
{ "network", "clearbanned", &clearbanned, true },
610-
{ "network", "setnetworkactive", &setnetworkactive, true, },
601+
{ "network", "getconnectioncount", &getconnectioncount, true, {} },
602+
{ "network", "ping", &ping, true, {} },
603+
{ "network", "getpeerinfo", &getpeerinfo, true, {} },
604+
{ "network", "addnode", &addnode, true, {"node","command"} },
605+
{ "network", "disconnectnode", &disconnectnode, true, {"node"} },
606+
{ "network", "getaddednodeinfo", &getaddednodeinfo, true, {"node"} },
607+
{ "network", "getnettotals", &getnettotals, true, {} },
608+
{ "network", "getnetworkinfo", &getnetworkinfo, true, {} },
609+
{ "network", "setban", &setban, true, {"subnet", "command", "bantime", "absolute"} },
610+
{ "network", "listbanned", &listbanned, true, {} },
611+
{ "network", "clearbanned", &clearbanned, true, {} },
612+
{ "network", "setnetworkactive", &setnetworkactive, true, {"state"} },
611613
};
612614

613615
void RegisterNetRPCCommands(CRPCTable &t)

0 commit comments

Comments
 (0)