diff --git a/src/rpc/abc.cpp b/src/rpc/abc.cpp index 3f45e5588..91ab2fe3d 100644 --- a/src/rpc/abc.cpp +++ b/src/rpc/abc.cpp @@ -1,94 +1,101 @@ // Copyright (c) 2017-2020 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include #include +#include #include #include #include static UniValue getexcessiveblock(const Config &config, const JSONRPCRequest &request) { if (request.fHelp || request.params.size() != 0) { throw std::runtime_error( - "getexcessiveblock\n" - "\nReturn the excessive block size." + RPCHelpMan{ + "getexcessiveblock", "\nReturn the excessive block size.", {}} + .ToString() + "\nResult\n" " excessiveBlockSize (integer) block size in bytes\n" "\nExamples:\n" + HelpExampleCli("getexcessiveblock", "") + HelpExampleRpc("getexcessiveblock", "")); } UniValue ret(UniValue::VOBJ); ret.pushKV("excessiveBlockSize", config.GetMaxBlockSize()); return ret; } static UniValue setexcessiveblock(Config &config, const JSONRPCRequest &request) { if (request.fHelp || request.params.size() != 1) { throw std::runtime_error( - "setexcessiveblock blockSize\n" - "\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." + 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, false}, + }} + .ToString() + "\nArguments\n" "1. blockSize (integer, required) Excessive block size in bytes. " "Must be greater than " + std::to_string(LEGACY_MAX_BLOCK_SIZE) + ".\n" "\nResult\n" " blockSize (integer) excessive block size in bytes\n" "\nExamples:\n" + HelpExampleCli("setexcessiveblock", "25000000") + HelpExampleRpc("setexcessiveblock", "25000000")); } int64_t ebs = 0; if (request.params[0].isNum()) { ebs = request.params[0].get_int64(); } else if (!ParseInt64(request.params[0].get_str(), &ebs)) { throw JSONRPCError( RPC_INVALID_PARAMETER, std::string( "Invalid parameter, excessiveblock must be an integer")); } // Do not allow maxBlockSize to be set below historic 1MB limit if (ebs <= int64_t(LEGACY_MAX_BLOCK_SIZE)) { throw JSONRPCError( RPC_INVALID_PARAMETER, std::string( "Invalid parameter, excessiveblock must be larger than ") + std::to_string(LEGACY_MAX_BLOCK_SIZE)); } // Set the new max block size. if (!config.SetMaxBlockSize(ebs)) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Unexpected error"); } // settingsToUserAgentString(); std::ostringstream ret; ret << "Excessive Block set to " << ebs << " bytes."; return UniValue(ret.str()); } // clang-format off static const ContextFreeRPCCommand commands[] = { // category name actor (function) argNames // ------------------- ------------------------ ---------------------- ---------- { "network", "getexcessiveblock", getexcessiveblock, {}}, { "network", "setexcessiveblock", setexcessiveblock, {"maxBlockSize"}}, }; // clang-format on void RegisterABCRPCCommands(CRPCTable &t) { for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) { t.appendCommand(commands[vcidx].name, &commands[vcidx]); } } diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index c78790140..3790e8597 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1,2604 +1,2758 @@ // Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include