Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/abc.cpp
// Copyright (c) 2017-2020 The Bitcoin developers | // Copyright (c) 2017-2020 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <config.h> | #include <config.h> | ||||
#include <consensus/consensus.h> | #include <consensus/consensus.h> | ||||
#include <rpc/server.h> | #include <rpc/server.h> | ||||
#include <rpc/util.h> | |||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
#include <validation.h> | #include <validation.h> | ||||
#include <univalue.h> | #include <univalue.h> | ||||
static UniValue getexcessiveblock(const Config &config, | static UniValue getexcessiveblock(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 0) { | if (request.fHelp || request.params.size() != 0) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"getexcessiveblock\n" | RPCHelpMan{ | ||||
"\nReturn the excessive block size." | "getexcessiveblock", "\nReturn the excessive block size.", {}} | ||||
.ToString() + | |||||
"\nResult\n" | "\nResult\n" | ||||
" excessiveBlockSize (integer) block size in bytes\n" | " excessiveBlockSize (integer) block size in bytes\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("getexcessiveblock", "") + | HelpExampleCli("getexcessiveblock", "") + | ||||
HelpExampleRpc("getexcessiveblock", "")); | HelpExampleRpc("getexcessiveblock", "")); | ||||
} | } | ||||
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) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"setexcessiveblock blockSize\n" | RPCHelpMan{ | ||||
"\nSet the excessive block size. Excessive blocks will not be used " | "setexcessiveblock", | ||||
"in the active chain or relayed. This discourages the propagation " | "\nSet the excessive block size. Excessive blocks will not be " | ||||
"of blocks that you consider excessively large." | "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" | "\nArguments\n" | ||||
"1. blockSize (integer, required) Excessive block size in bytes. " | "1. blockSize (integer, required) Excessive block size in bytes. " | ||||
"Must be greater than " + | "Must be greater than " + | ||||
std::to_string(LEGACY_MAX_BLOCK_SIZE) + | std::to_string(LEGACY_MAX_BLOCK_SIZE) + | ||||
".\n" | ".\n" | ||||
"\nResult\n" | "\nResult\n" | ||||
" blockSize (integer) excessive block size in bytes\n" | " blockSize (integer) excessive block size in bytes\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |