Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/abc.cpp
Show All 12 Lines | |||||
#include <univalue.h> | #include <univalue.h> | ||||
static UniValue getexcessiveblock(const Config &config, | static UniValue getexcessiveblock(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"getexcessiveblock", | "getexcessiveblock", | ||||
"Return the excessive block size.", | "Return the excessive block size.", | ||||
{}, | {}, | ||||
RPCResult{" excessiveBlockSize (integer) block size in bytes\n"}, | RPCResult{RPCResult::Type::NUM, "", "excessive block size in bytes"}, | ||||
RPCExamples{HelpExampleCli("getexcessiveblock", "") + | RPCExamples{HelpExampleCli("getexcessiveblock", "") + | ||||
HelpExampleRpc("getexcessiveblock", "")}, | HelpExampleRpc("getexcessiveblock", "")}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
UniValue ret(UniValue::VOBJ); | UniValue ret(UniValue::VOBJ); | ||||
ret.pushKV("excessiveBlockSize", config.GetMaxBlockSize()); | ret.pushKV("excessiveBlockSize", config.GetMaxBlockSize()); | ||||
return ret; | return ret; | ||||
} | } | ||||
static UniValue setexcessiveblock(Config &config, | static UniValue setexcessiveblock(Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"setexcessiveblock", | "setexcessiveblock", | ||||
"Set the excessive block size. Excessive blocks will not be used in " | "Set the excessive block size. Excessive blocks will not be used in " | ||||
"the active chain or relayed. This discourages the propagation of " | "the active chain or relayed. This discourages the propagation of " | ||||
"blocks that you consider excessively large.", | "blocks that you consider excessively large.", | ||||
{ | { | ||||
{"blockSize", RPCArg::Type::NUM, RPCArg::Optional::NO, | {"blockSize", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
"Excessive block size in bytes. Must be greater than " + | "Excessive block size in bytes. Must be greater than " + | ||||
std::to_string(LEGACY_MAX_BLOCK_SIZE) + "."}, | std::to_string(LEGACY_MAX_BLOCK_SIZE) + "."}, | ||||
}, | }, | ||||
RPCResult{" blockSize (integer) excessive block size in bytes\n"}, | RPCResult{RPCResult::Type::NUM, "", "excessive block size in bytes"}, | ||||
RPCExamples{HelpExampleCli("setexcessiveblock", "25000000") + | RPCExamples{HelpExampleCli("setexcessiveblock", "25000000") + | ||||
HelpExampleRpc("setexcessiveblock", "25000000")}, | HelpExampleRpc("setexcessiveblock", "25000000")}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
if (!request.params[0].isNum()) { | if (!request.params[0].isNum()) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_INVALID_PARAMETER, | RPC_INVALID_PARAMETER, | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |