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 <rpc/util.h> | ||||
#include <sync.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) { | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | if (ebs <= int64_t(LEGACY_MAX_BLOCK_SIZE)) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_INVALID_PARAMETER, | RPC_INVALID_PARAMETER, | ||||
std::string( | std::string( | ||||
"Invalid parameter, excessiveblock must be larger than ") + | "Invalid parameter, excessiveblock must be larger than ") + | ||||
std::to_string(LEGACY_MAX_BLOCK_SIZE)); | std::to_string(LEGACY_MAX_BLOCK_SIZE)); | ||||
} | } | ||||
// Set the new max block size. | // Set the new max block size. | ||||
{ | |||||
LOCK(cs_main); | |||||
if (!config.SetMaxBlockSize(ebs)) { | if (!config.SetMaxBlockSize(ebs)) { | ||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Unexpected error"); | throw JSONRPCError(RPC_INVALID_PARAMETER, "Unexpected error"); | ||||
} | } | ||||
} | |||||
// settingsToUserAgentString(); | // settingsToUserAgentString(); | ||||
std::ostringstream ret; | std::ostringstream ret; | ||||
ret << "Excessive Block set to " << ebs << " bytes."; | ret << "Excessive Block set to " << ebs << " bytes."; | ||||
return UniValue(ret.str()); | return UniValue(ret.str()); | ||||
} | } | ||||
// clang-format off | // clang-format off | ||||
Show All 13 Lines |