diff --git a/src/rpc/abc.cpp b/src/rpc/abc.cpp --- a/src/rpc/abc.cpp +++ b/src/rpc/abc.cpp @@ -14,17 +14,15 @@ static UniValue getexcessiveblock(const Config &config, const JSONRPCRequest &request) { - if (request.fHelp || request.params.size() != 0) { - throw std::runtime_error(RPCHelpMan{ - "getexcessiveblock", - "\nReturn the excessive block size.", - {}, - RPCResult{" excessiveBlockSize (integer) block size in bytes\n"}, - RPCExamples{HelpExampleCli("getexcessiveblock", "") + - HelpExampleRpc("getexcessiveblock", "")}, - } - .ToString()); + RPCHelpMan{ + "getexcessiveblock", + "\nReturn the excessive block size.", + {}, + RPCResult{" excessiveBlockSize (integer) block size in bytes\n"}, + RPCExamples{HelpExampleCli("getexcessiveblock", "") + + HelpExampleRpc("getexcessiveblock", "")}, } + .Check(request); UniValue ret(UniValue::VOBJ); ret.pushKV("excessiveBlockSize", config.GetMaxBlockSize()); @@ -33,23 +31,21 @@ static UniValue setexcessiveblock(Config &config, const JSONRPCRequest &request) { - if (request.fHelp || request.params.size() != 1) { - throw std::runtime_error(RPCHelpMan{ - "setexcessiveblock", - "\nSet the excessive block size. Excessive blocks will not be used " - "in the active chain or relayed. This discourages the propagation " - "of blocks that you consider excessively large.", - { - {"blockSize", RPCArg::Type::NUM, RPCArg::Optional::NO, - "Excessive block size in bytes. Must be greater than " + - std::to_string(LEGACY_MAX_BLOCK_SIZE) + "."}, - }, - RPCResult{" blockSize (integer) excessive block size in bytes\n"}, - RPCExamples{HelpExampleCli("setexcessiveblock", "25000000") + - HelpExampleRpc("setexcessiveblock", "25000000")}, - } - .ToString()); + RPCHelpMan{ + "setexcessiveblock", + "\nSet the excessive block size. Excessive blocks will not be used in " + "the active chain or relayed. This discourages the propagation of " + "blocks that you consider excessively large.", + { + {"blockSize", RPCArg::Type::NUM, RPCArg::Optional::NO, + "Excessive block size in bytes. Must be greater than " + + std::to_string(LEGACY_MAX_BLOCK_SIZE) + "."}, + }, + RPCResult{" blockSize (integer) excessive block size in bytes\n"}, + RPCExamples{HelpExampleCli("setexcessiveblock", "25000000") + + HelpExampleRpc("setexcessiveblock", "25000000")}, } + .Check(request); if (!request.params[0].isNum()) { throw JSONRPCError( diff --git a/src/rpc/avalanche.cpp b/src/rpc/avalanche.cpp --- a/src/rpc/avalanche.cpp +++ b/src/rpc/avalanche.cpp @@ -13,16 +13,14 @@ static UniValue getavalanchekey(const Config &config, const JSONRPCRequest &request) { - if (request.fHelp || request.params.size() != 0) { - throw std::runtime_error(RPCHelpMan{ - "getavalanchekey", - "\nReturns the key used to sign avalanche messages.\n", - {}, - RPCResults{}, - RPCExamples{HelpExampleRpc("getavalanchekey", "")}, - } - .ToString()); + RPCHelpMan{ + "getavalanchekey", + "\nReturns the key used to sign avalanche messages.\n", + {}, + RPCResults{}, + RPCExamples{HelpExampleRpc("getavalanchekey", "")}, } + .Check(request); if (!g_avalanche) { throw JSONRPCError(RPC_INTERNAL_ERROR, "Avalanche is not initialized"); @@ -33,21 +31,19 @@ static UniValue addavalanchepeer(const Config &config, const JSONRPCRequest &request) { - if (request.fHelp || request.params.size() != 2) { - throw std::runtime_error(RPCHelpMan{ - "addavalanchepeer", - "\nAdd a peer to the set of peer to poll for avalanche.\n", - { - {"nodeid", RPCArg::Type::NUM, RPCArg::Optional::NO, - "Node to be added to avalanche."}, - {"publickey", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, - "The public key of the node."}, - }, - RPCResults{}, - RPCExamples{HelpExampleRpc("addavalanchepeer", "5")}, - } - .ToString()); + RPCHelpMan{ + "addavalanchepeer", + "\nAdd a peer to the set of peer to poll for avalanche.\n", + { + {"nodeid", RPCArg::Type::NUM, RPCArg::Optional::NO, + "Node to be added to avalanche."}, + {"publickey", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, + "The public key of the node."}, + }, + RPCResults{}, + RPCExamples{HelpExampleRpc("addavalanchepeer", "5")}, } + .Check(request); if (!g_avalanche) { throw JSONRPCError(RPC_INTERNAL_ERROR, "Avalanche is not initialized");