Bitcoin ABC  0.24.10
P2P Digital Currency
abc.cpp
Go to the documentation of this file.
1 // Copyright (c) 2017-2020 The Bitcoin developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <config.h>
6 #include <consensus/consensus.h>
7 #include <rpc/server.h>
8 #include <rpc/util.h>
9 #include <sync.h>
10 #include <util/strencodings.h>
11 #include <util/string.h>
12 #include <validation.h>
13 
14 #include <univalue.h>
15 
17  return RPCHelpMan{
18  "getexcessiveblock",
19  "Return the excessive block size.",
20  {},
21  RPCResult{RPCResult::Type::NUM, "", "excessive block size in bytes"},
22  RPCExamples{HelpExampleCli("getexcessiveblock", "") +
23  HelpExampleRpc("getexcessiveblock", "")},
24  [&](const RPCHelpMan &self, const Config &config,
25  const JSONRPCRequest &request) -> UniValue {
27  ret.pushKV("excessiveBlockSize", config.GetMaxBlockSize());
28  return ret;
29  },
30  };
31 }
32 
34  // clang-format off
35  static const CRPCCommand commands[] = {
36  // category actor (function)
37  // ------------------ ----------------------
38  { "network", getexcessiveblock, },
39  };
40  // clang-format on
41 
42  for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) {
43  t.appendCommand(commands[vcidx].name, &commands[vcidx]);
44  }
45 }
HelpExampleCli
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
Definition: util.cpp:157
UniValue::VOBJ
@ VOBJ
Definition: univalue.h:27
RPCHelpMan
Definition: util.h:334
sync.h
string.h
RPCResult::Type::NUM
@ NUM
UniValue::pushKV
bool pushKV(const std::string &key, const UniValue &val)
Definition: univalue.cpp:133
UniValue
Definition: univalue.h:23
strencodings.h
Config
Definition: config.h:17
CRPCCommand
Definition: server.h:147
univalue.h
consensus.h
RPCExamples
Definition: util.h:326
HelpExampleRpc
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
Definition: util.cpp:162
CRPCTable
RPC command dispatcher.
Definition: server.h:184
name
const char * name
Definition: rest.cpp:43
CRPCTable::appendCommand
void appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
Definition: server.cpp:322
ARRAYLEN
#define ARRAYLEN(array)
Utilities for converting data from/to strings.
Definition: strencodings.h:20
config.h
JSONRPCRequest
Definition: request.h:33
util.h
RPCResult
Definition: util.h:247
server.h
getexcessiveblock
static RPCHelpMan getexcessiveblock()
Definition: abc.cpp:16
RegisterABCRPCCommands
void RegisterABCRPCCommands(CRPCTable &t)
Register ABC RPC commands.
Definition: abc.cpp:33