11#include <chainparams.h>
43#include <validation.h>
44#ifdef ENABLE_EMBEDDED_ASMAP
46#include <node/data/ip_asn.dat.h>
72 "outbound-full-relay (default automatic connections)",
73 "block-relay-only (does not relay transactions or addresses)",
74 "inbound (initiated by the peer)",
75 "manual (added via addnode RPC or -addnode/-connect configuration options)",
76 "addr-fetch (short-lived automatic connection for soliciting addresses)",
77 "feeler (short-lived automatic connection for testing addresses)",
78 "private-broadcast (short-lived automatic connection for broadcasting privacy-sensitive transactions)"
82 "detecting (peer could be v1 or v2)",
83 "v1 (plaintext transport protocol)",
84 "v2 (BIP324 encrypted transport protocol)"
91 "Returns the number of connections to other nodes.\n",
114 "Requests that a ping be sent to all other nodes, to measure ping time.\n"
115 "Results are provided in getpeerinfo.\n"
116 "Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.\n",
151 "Returns data about each connected network peer as a json array of objects.",
160 {
RPCResult::Type::STR,
"addr",
"(host:port) The IP address/hostname optionally followed by :port of the peer"},
161 {
RPCResult::Type::STR,
"addrbind",
true,
"(ip:port) Bind address of the connection to the peer"},
164 {
RPCResult::Type::NUM,
"mapped_as",
true,
"Mapped AS (Autonomous System) number at the end of the BGP route to the peer, used for diversifying\n"
165 "peer selection (only displayed if the -asmap config option is set)"},
185 {
RPCResult::Type::NUM,
"pingwait",
true,
"The duration in seconds of an outstanding ping (if non-zero)"},
189 {
RPCResult::Type::BOOL,
"bip152_hb_to",
"Whether we selected peer as (compact blocks) high-bandwidth peer"},
190 {
RPCResult::Type::BOOL,
"bip152_hb_from",
"Whether peer selected us as (compact blocks) high-bandwidth peer"},
191 {
RPCResult::Type::NUM,
"presynced_headers",
"The current height of header pre-synchronization with this peer, or -1 if no low-work sync is in progress"},
198 {
RPCResult::Type::BOOL,
"addr_relay_enabled",
"Whether we participate in address relay with this peer"},
199 {
RPCResult::Type::NUM,
"addr_processed",
"The total number of addresses processed, excluding those dropped due to rate limiting"},
200 {
RPCResult::Type::NUM,
"addr_rate_limited",
"The total number of addresses dropped due to rate limiting"},
201 {
RPCResult::Type::ARR,
"permissions",
"Any special permissions that have been granted to this peer",
209 "When a message type is not listed in this json object, the bytes sent are 0.\n"
210 "Only known message types can appear as keys in the object."}
215 "When a message type is not listed in this json object, the bytes received are 0.\n"
216 "Only known message types can appear as keys in the object and all bytes received\n"
220 "Please note this output is unlikely to be stable in upcoming releases as we iterate to\n"
221 "best capture connection behaviors."},
223 {
RPCResult::Type::STR,
"session_id",
"The session ID for this connection, or \"\" if there is none (\"v2\" transport protocol only).\n"},
237 std::vector<CNodeStats>
vstats;
254 obj.pushKV(
"id", stats.nodeid);
255 obj.pushKV(
"addr", stats.m_addr_name);
256 if (stats.addrBind.IsValid()) {
257 obj.pushKV(
"addrbind", stats.addrBind.ToStringAddrPort());
259 if (!(stats.addrLocal.empty())) {
260 obj.pushKV(
"addrlocal", stats.addrLocal);
263 if (stats.m_mapped_as != 0) {
264 obj.pushKV(
"mapped_as", stats.m_mapped_as);
277 obj.pushKV(
"bytessent", stats.nSendBytes);
278 obj.pushKV(
"bytesrecv", stats.nRecvBytes);
281 if (stats.m_last_ping_time > 0
us) {
290 obj.pushKV(
"version", stats.nVersion);
294 obj.pushKV(
"subver", stats.cleanSubVer);
295 obj.pushKV(
"inbound", stats.fInbound);
296 obj.pushKV(
"bip152_hb_to", stats.m_bip152_highbandwidth_to);
297 obj.pushKV(
"bip152_hb_from", stats.m_bip152_highbandwidth_from);
302 for (
const int height :
statestats.vHeightInFlight) {
306 obj.pushKV(
"addr_relay_enabled",
statestats.m_addr_relay_enabled);
308 obj.pushKV(
"addr_rate_limited",
statestats.m_addr_rate_limited);
333 obj.pushKV(
"session_id", stats.m_session_id);
335 ret.push_back(std::move(
obj));
347 "Attempts to add or remove a node from the addnode list.\n"
348 "Or try a connection to a node once.\n"
349 "Nodes added using addnode (or -connect) are protected from DoS disconnection and IBD block stalling\n"
350 "disconnection, and are not required to be full nodes or support SegWit as other outbound peers are (though\n"
351 "such peers will not be synced from).\n" +
353 " and are counted separately from the -maxconnections limit.\n",
362 +
HelpExampleRpc(
"addnode", R
"("192.168.0.6:8333", "onetry", true)")
366 const auto command{
self.Arg<std::string_view>(
"command")};
368 throw std::runtime_error(
375 const auto node_arg{
self.Arg<std::string_view>(
"node")};
376 if (TrimStringView(
node_arg).empty()) {
403 if (!connman.
AddNode({std::string{node_arg}, use_v2transport})) {
409 if (!connman.RemoveAddedNode(
node_arg)) {
423 "Open an outbound connection to a specified node. This RPC is for testing only.\n",
426 {
"connection_type",
RPCArg::Type::STR,
RPCArg::Optional::NO,
"Type of connection to open (\"outbound-full-relay\", \"block-relay-only\", \"addr-fetch\", \"feeler\" or \"manual\")."},
436 HelpExampleCli(
"addconnection",
"\"192.168.0.6:8333\" \"outbound-full-relay\" true")
437 +
HelpExampleRpc(
"addconnection", R
"("192.168.0.6:8333", "outbound-full-relay", true)")
442 throw std::runtime_error(
"addconnection is for regression testing (-regtest mode) only.");
445 const std::string address = request.params[0].get_str();
461 bool use_v2transport{
self.Arg<
bool>(
"v2transport")};
470 const bool success = connman.
AddConnection(address, conn_type, use_v2transport);
476 info.
pushKV(
"address", address);
488 "Immediately disconnects from the specified peer node.\n"
489 "\nStrictly one out of 'address' and 'nodeid' can be provided to identify the node.\n"
490 "\nTo disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.\n",
508 auto address{
self.MaybeArg<std::string_view>(
"address")};
514 }
else if (
node_id && (!address || address->empty())) {
534 "Returns information about the given added node, or all added nodes\n"
535 "(note that onetry addnodes are not listed here)\n",
568 if (
auto node{
self.MaybeArg<std::string_view>(
"node")}) {
571 if (info.m_params.m_added_node == *
node) {
572 vInfo.assign(1, info);
586 obj.pushKV(
"addednode", info.m_params.m_added_node);
587 obj.pushKV(
"connected", info.fConnected);
589 if (info.fConnected) {
591 address.
pushKV(
"address", info.resolvedAddress.ToStringAddrPort());
592 address.
pushKV(
"connected", info.fInbound ?
"inbound" :
"outbound");
596 ret.push_back(std::move(
obj));
607 "Returns information about network traffic, including bytes in, bytes out,\n"
608 "and current system time.",
657 for (
int n = 0; n <
NET_MAX; ++n) {
664 if (
const auto proxy =
GetProxy(network)) {
665 obj.pushKV(
"proxy", proxy->ToString());
666 obj.pushKV(
"proxy_randomize_credentials", proxy->m_tor_stream_isolation);
668 obj.pushKV(
"proxy", std::string());
669 obj.pushKV(
"proxy_randomize_credentials",
false);
679 "Returns an object containing various state info regarding P2P networking.\n",
688 {
RPCResult::Type::ARR,
"localservicesnames",
"the services we offer to the network, in human-readable form",
694 {
RPCResult::Type::NUM,
"tx_send_rate",
"configured target for maximum number of transactions per second to send to inbound peers"},
715 {
RPCResult::Type::STR,
"proxy",
"(\"host:port\") the proxy that is used for this network, or empty if none"},
719 {
RPCResult::Type::STR_HEX,
"asmap_version",
true,
"the SHA256 hash of the asmap data used for IP bucketing (only displayed if the -asmap config option is set)"},
733 RPCResult{
RPCResult::Type::ARR,
"warnings",
"any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)",
755 obj.pushKV(
"localservices",
strprintf(
"%016x", services));
764 b.pushKV(
"count_tok",
buckinfo.count_bucket);
765 b.pushKV(
"size_tok",
buckinfo.size_bucket);
778 if (netgroupman.UsingASMap()) {
779 obj.pushKV(
"asmap_version",
HexStr(netgroupman.GetAsmapVersion()));
788 for (
const std::pair<const CNetAddr, LocalServiceInfo> &
item :
mapLocalHost)
791 rec.
pushKV(
"address",
item.first.ToStringAddr());
808 "Attempts to add or remove an IP/Subnet from the banned list.\n",
812 {
"bantime",
RPCArg::Type::NUM,
RPCArg::Default{0},
"time in seconds how long (or until when if [absolute] is set) the IP is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)"},
837 if (addr.has_value()) {
854 if (!request.params[2].isNull())
857 const bool absolute{request.params[3].isNull() ?
false : request.params[3].get_bool()};
874 }
else if(
command ==
"remove") {
888 "List all manually banned IPs/Subnets.\n",
914 for (
const auto& entry :
banMap)
916 const CBanEntry& banEntry = entry.second;
918 rec.
pushKV(
"address", entry.first.ToString());
936 "Clear all banned IPs.\n",
958 "Disable/enable all p2p network activity.\n",
979 "Return known addresses, after filtering for quality and recency.\n"
980 "These can potentially be used to find new peers in the network.\n"
981 "The total number of addresses known to the node may be higher.",
1002 +
HelpExampleCli(
"-named getnodeaddresses",
"network=onion count=12")
1011 const int count{request.params[0].isNull() ? 1 : request.params[0].getInt<
int>()};
1014 const std::optional<Network> network{request.params[1].isNull() ? std::nullopt : std::optional<Network>{
ParseNetwork(request.params[1].get_str())}};
1026 obj.pushKV(
"services",
static_cast<std::underlying_type_t<
decltype(addr.nServices)
>>(addr.nServices));
1027 obj.pushKV(
"address", addr.ToStringAddr());
1028 obj.pushKV(
"port", addr.GetPort());
1030 ret.push_back(std::move(
obj));
1040 "Add the address of a potential peer to an address manager table. This RPC is for testing only.",
1049 {
RPCResult::Type::BOOL,
"success",
"whether the peer address was successfully added to the address manager table"},
1061 const std::string&
addr_string{request.params[0].get_str()};
1062 const auto port{request.params[1].getInt<
uint16_t>()};
1063 const bool tried{request.params[2].isNull() ?
false : request.params[2].get_bool()};
1071 bool success{
false};
1078 if (addrman.
Add({address}, address)) {
1082 if (!addrman.
Good(address)) {
1084 obj.pushKV(
"error",
"failed-adding-to-tried");
1088 obj.pushKV(
"error",
"failed-adding-to-new");
1091 obj.pushKV(
"success", success);
1101 "Send a p2p message to a peer specified by id.\n"
1102 "The message type and body must be provided, the message header will be generated.\n"
1103 "This RPC is for testing only.",
1114 const auto msg_type{
self.Arg<std::string_view>(
"msg_type")};
1119 if (!msg.has_value()) {
1149 "Provides information about the node's address manager by returning the number of "
1150 "unique addresses in the `new` and `tried` tables and their sum for all networks.\n",
1155 {
RPCResult::Type::NUM,
"new",
"number of unique addresses in the new table, which represent potential peers the node has discovered but hasn't yet successfully connected to. "
1156 "An address can be stored in multiple new table buckets but is counted only once."},
1157 {
RPCResult::Type::NUM,
"tried",
"number of addresses in the tried table, which represent peers the node has successfully connected to in the past."},
1166 for (
int n = 0; n <
NET_MAX; ++n) {
1170 obj.pushKV(
"new", addrman.
Size(network,
true));
1171 obj.pushKV(
"tried", addrman.
Size(network,
false));
1172 obj.pushKV(
"total", addrman.
Size(network));
1176 obj.pushKV(
"new", addrman.
Size(std::nullopt,
true));
1177 obj.pushKV(
"tried", addrman.
Size(std::nullopt,
false));
1178 obj.pushKV(
"total", addrman.
Size());
1179 ret.pushKV(
"all_networks", std::move(
obj));
1189 "Export the embedded ASMap data to a file. Any existing file at the path will be overwritten.\n",
1204#ifndef ENABLE_EMBEDDED_ASMAP
1215 if (file.IsNull()) {
1219 file << node::data::ip_asn;
1221 if (file.fclose() != 0) {
1227 result.
pushKV(
"bytes_written", node::data::ip_asn.size());
1241 ret.pushKV(
"mapped_as", mapped_as);
1244 ret.pushKV(
"services",
static_cast<std::underlying_type_t<
decltype(info.nServices)
>>(info.
nServices));
1262 std::ostringstream key;
1275 "EXPERIMENTAL warning: this call may be changed in future releases.\n"
1276 "\nReturns information on all address manager entries for the new and tried tables.\n",
1281 {
RPCResult::Type::OBJ,
"bucket/position",
"the location in the address manager table (<bucket>/<position>)", {
1283 {
RPCResult::Type::NUM,
"mapped_as",
true,
"Mapped AS (Autonomous System) number at the end of the BGP route to the peer, used for diversifying peer selection (only displayed if the -asmap config option is set)"},
1290 {
RPCResult::Type::NUM,
"source_mapped_as",
true,
"Mapped AS (Autonomous System) number at the end of the BGP route to the source, used for diversifying peer selection (only displayed if the -asmap config option is set)"}
1336 t.appendCommand(
c.name, &
c);
const CChainParams & Params()
Return the currently selected parameters.
#define CHECK_NONFATAL(condition)
Identity function.
Extended statistics about a CAddress.
CNetAddr source
where knowledge about this address first came from
Stochastic address manager.
size_t Size(std::optional< Network > net=std::nullopt, std::optional< bool > in_new=std::nullopt) const
Return size information about addrman.
std::vector< std::pair< AddrInfo, AddressPosition > > GetEntries(bool from_tried) const
Returns an information-location pair for all addresses in the selected addrman table.
bool Good(const CService &addr, NodeSeconds time=Now< NodeSeconds >())
Mark an address record as accessible and attempt to move it to addrman's tried table.
bool Add(const std::vector< CAddress > &vAddr, const CNetAddr &source, std::chrono::seconds time_penalty=0s)
Attempt to add one or more addresses to addrman's new table.
fs::path GetDataDirNet() const EXCLUSIVE_LOCKS_REQUIRED(!cs_args)
Get data directory path with appended network identifier.
Non-refcounted RAII wrapper for FILE*.
void Ban(const CNetAddr &net_addr, int64_t ban_time_offset=0, bool since_unix_epoch=false) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
bool IsBanned(const CNetAddr &net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
Return whether net_addr is banned.
void GetBanned(banmap_t &banmap) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
void ClearBanned() EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
bool Unban(const CNetAddr &net_addr) EXCLUSIVE_LOCKS_REQUIRED(!m_banned_mutex)
A CService with information about it as peer.
ServiceFlags nServices
Serialized as uint64_t in V1, and as CompactSize in V2.
NodeSeconds nTime
Always included in serialization. The behavior is unspecified if the value is not representable as ui...
ChainType GetChainType() const
Return the chain type.
bool GetNetworkActive() const
bool OutboundTargetReached(bool historicalBlockServingLimit) const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
check if the outbound target is reached if param historicalBlockServingLimit is set true,...
uint64_t GetMaxOutboundTarget() const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
bool AddConnection(const std::string &address, ConnectionType conn_type, bool use_v2transport) EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex
Attempts to open a connection.
std::chrono::seconds GetMaxOutboundTimeframe() const
ServiceFlags GetLocalServices() const
Used to convey which local services we are offering peers during node connection.
bool AddNode(const AddedNodeParams &add) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex)
std::vector< AddedNodeInfo > GetAddedNodeInfo(bool include_connected) const EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex
void SetNetworkActive(bool active) EXCLUSIVE_LOCKS_REQUIRED(!m_anchors_mutex
uint32_t GetMappedAS(const CNetAddr &addr) const
uint64_t GetTotalBytesRecv() const
bool OpenNetworkConnection(const CAddress &addrConnect, bool fCountFailure, CountingSemaphoreGrant<> &&grant_outbound, const char *pszDest, ConnectionType conn_type, bool use_v2transport, const std::optional< Proxy > &proxy_override) EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex
Open a new P2P connection and initialize it with the PeerManager at m_msgproc.
std::chrono::seconds GetMaxOutboundTimeLeftInCycle() const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
void GetNodeStats(std::vector< CNodeStats > &vstats) const EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex)
bool ForNode(NodeId id, std::function< bool(CNode *pnode)> func) EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex)
std::vector< CAddress > GetAddressesUnsafe(size_t max_addresses, size_t max_pct, std::optional< Network > network, bool filtered=true) const
Return randomly selected addresses.
bool DisconnectNode(std::string_view node) EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex)
uint64_t GetTotalBytesSent() const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
size_t GetNodeCount(ConnectionDirection) const EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex)
uint64_t GetOutboundTargetBytesLeft() const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
response the bytes left in the current max outbound cycle in case of no limit, it will always respons...
void PushMessage(CNode *pnode, CSerializedNetMsg &&msg) EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
CAmount GetFeePerK() const
Return the fee in satoshis for a vsize of 1000 vbytes.
Network GetNetClass() const
std::string ToStringAddr() const
Information about a peer.
std::atomic< NodeClock::duration > m_min_ping_time
Lowest measured round-trip duration.
A combination of a network address (CNetAddr) and a (TCP) port.
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
static std::vector< std::string > ToStrings(NetPermissionFlags flags)
virtual void SendPings()=0
Send ping message to all peers.
virtual PeerManagerInfo GetInfo() const =0
Get peer manager info.
virtual bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) const =0
Get statistics from node state.
std::string ToString() const
auto Arg(std::string_view key) const
Helper to get a required or default-valued request argument.
bool Contains(Network net) const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
void pushKVEnd(std::string key, UniValue val)
void pushKV(std::string key, UniValue val)
constexpr int CLIENT_VERSION
std::string TransportTypeAsString(TransportProtocolType transport_type)
Convert TransportProtocolType enum to a string value.
std::string ConnectionTypeAsString(ConnectionType conn_type)
Convert ConnectionType enum to a string value.
ConnectionType
Different types of connections to a peer.
@ BLOCK_RELAY
We use block-relay-only connections to help prevent against partition attacks.
@ MANUAL
We open manual connections to addresses that users explicitly requested via the addnode RPC or the -a...
@ OUTBOUND_FULL_RELAY
These are the default connections that we use to connect with the network.
@ FEELER
Feeler connections are short-lived connections made to check that a node is alive.
@ ADDR_FETCH
AddrFetch connections are short lived connections used to solicit addresses from peers.
UniValue ValueFromAmount(const CAmount amount)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
const std::string CURRENCY_UNIT
static path u8path(std::string_view utf8_str)
static std::string PathToString(const path &path)
Convert path object to a byte string.
std::string HexStr(const std::span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
FILE * fopen(const fs::path &p, const char *mode)
fs::path AbsPathJoin(const fs::path &base, const fs::path &path)
Helper function for joining two paths.
UniValue GetWarningsForRpc(const Warnings &warnings, bool use_deprecated)
RPC helper function that wraps warnings.GetMessages().
std::string_view TrimStringView(std::string_view str LIFETIMEBOUND, std::string_view pattern=" \f\n\r\t\v")
auto Join(const C &container, const S &separator, UnaryOp unary_op)
Join all container items.
std::string strSubVersion
Subversion as sent to the P2P network in version messages.
const std::string NET_MESSAGE_TYPE_OTHER
GlobalMutex g_maplocalhost_mutex
constexpr int MAX_ADDNODE_CONNECTIONS
Maximum number of addnode outgoing nodes.
const std::vector< std::string > NET_PERMISSIONS_DOC
std::map< CSubNet, CBanEntry > banmap_t
@ NET_MAX
Dummy value to indicate the number of NET_* constants.
@ NET_UNROUTABLE
Addresses from these networks are not publicly routable on the global Internet.
@ NET_INTERNAL
A set of addresses that represent the hash of a string or FQDN.
CSubNet LookupSubNet(const std::string &subnet_str)
Parse and resolve a specified subnet string into the appropriate internal representation.
std::vector< CNetAddr > LookupHost(const std::string &name, unsigned int nMaxSolutions, bool fAllowLookup, DNSLookupFn dns_lookup_function)
Resolve a host string to its corresponding network addresses.
std::string GetNetworkName(enum Network net)
enum Network ParseNetwork(const std::string &net_in)
CService MaybeFlipIPv6toCJDNS(const CService &service)
If an IPv6 address belongs to the address range used by the CJDNS network and the CJDNS network is re...
ReachableNets g_reachable_nets
std::optional< Proxy > GetProxy(enum Network net)
std::vector< std::string > GetNetworkNames(bool append_unroutable)
Return a vector of publicly routable Network names; optionally append NET_UNROUTABLE.
std::vector< std::string > serviceFlagsToStr(uint64_t flags)
Convert service flags (a bitmask of NODE_*) to human readable strings.
ServiceFlags
nServices flags
constexpr int PROTOCOL_VERSION
network protocol versioning
UniValue JSONRPCError(int code, const std::string &message)
const std::vector< std::string > CONNECTION_TYPE_DOC
void RegisterNetRPCCommands(CRPCTable &t)
static RPCMethod disconnectnode()
static RPCMethod addpeeraddress()
static RPCMethod addnode()
static RPCMethod getrawaddrman()
static RPCMethod getaddednodeinfo()
static RPCMethod getnetworkinfo()
static RPCMethod getaddrmaninfo()
static RPCMethod listbanned()
static UniValue GetNetworksInfo()
static RPCMethod clearbanned()
UniValue AddrmanTableToJSON(const std::vector< std::pair< AddrInfo, AddressPosition > > &tableInfos, const CConnman &connman)
static RPCMethod exportasmap()
const std::vector< std::string > TRANSPORT_TYPE_DOC
static UniValue GetServicesNames(ServiceFlags services)
Returns, given services flags, a list of humanly readable (known) network services.
static RPCMethod sendmsgtopeer()
static RPCMethod getconnectioncount()
static RPCMethod getnodeaddresses()
static RPCMethod setban()
static RPCMethod getnettotals()
static RPCMethod addconnection()
static RPCMethod setnetworkactive()
UniValue AddrmanEntryToJSON(const AddrInfo &info, const CConnman &connman)
static RPCMethod getpeerinfo()
@ RPC_CLIENT_NODE_NOT_CONNECTED
Node to disconnect not found in connected nodes.
@ RPC_CLIENT_INVALID_IP_OR_SUBNET
Invalid IP/Subnet.
@ RPC_MISC_ERROR
General application defined errors.
@ RPC_CLIENT_NODE_ALREADY_ADDED
Node is already added.
@ RPC_INVALID_PARAMETER
Invalid, missing or duplicate parameter.
@ RPC_CLIENT_NODE_NOT_ADDED
Node has not been added before.
@ RPC_CLIENT_NODE_CAPACITY_REACHED
Max number of outbound or block-relay connections already open.
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
const std::string UNIX_EPOCH_TIME
String used to describe UNIX epoch time in documentation, factored out to a constant for consistency.
bool IsDeprecatedRPCEnabled(const std::string &method)
BanMan & EnsureBanman(const NodeContext &node)
AddrMan & EnsureAnyAddrman(const std::any &context)
NodeContext & EnsureAnyNodeContext(const std::any &context)
BanMan & EnsureAnyBanman(const std::any &context)
PeerManager & EnsurePeerman(const NodeContext &node)
CTxMemPool & EnsureAnyMemPool(const std::any &context)
CConnman & EnsureConnman(const NodeContext &node)
ArgsManager & EnsureAnyArgsman(const std::any &context)
Location information for an address in AddrMan.
std::vector< unsigned char > data
@ STR_HEX
Special type that is a STR with only hex chars.
std::string DefaultHint
Hint for default value.
@ NUM_TIME
Special numeric to denote unix epoch time.
@ OBJ_DYN
Special dictionary with keys that are not literals.
@ STR_HEX
Special string with only hex chars.
@ STR_AMOUNT
Special string to represent a floating point amount.
CFeeRate incremental_relay_feerate
CFeeRate min_relay_feerate
A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation)
NodeContext struct containing references to chain state and connection state.
bool CheckStandardAsmap(const std::span< const std::byte > data)
Provides a safe interface for validating ASMap data before use.
uint256 AsmapVersion(const std::span< const std::byte > data)
Computes SHA256 hash of ASMap data for versioning and consistency checks.
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
constexpr int64_t count_seconds(std::chrono::seconds t)
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.