10#include <chainparams.h>
32#include <validation.h>
43 "outbound-full-relay (default automatic connections)",
44 "block-relay-only (does not relay transactions or addresses)",
45 "inbound (initiated by the peer)",
46 "manual (added via addnode RPC or -addnode/-connect configuration options)",
47 "addr-fetch (short-lived automatic connection for soliciting addresses)",
48 "feeler (short-lived automatic connection for testing addresses)"
52 "detecting (peer could be v1 or v2)",
53 "v1 (plaintext transport protocol)",
54 "v2 (BIP324 encrypted transport protocol)"
60 "\nReturns the number of connections to other nodes.\n",
82 "\nRequests that a ping be sent to all other nodes, to measure ping time.\n"
83 "Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds.\n"
84 "Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.\n",
112 return servicesNames;
119 "Returns data about each connected network peer as a json array of objects.",
129 {
RPCResult::Type::STR,
"addrbind",
true,
"(ip:port) Bind address of the connection to the peer"},
132 {
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"
133 "peer selection (only displayed if the -asmap config option is set)"},
149 {
RPCResult::Type::NUM,
"minping",
true,
"The minimum observed ping time in milliseconds (ms), if any"},
150 {
RPCResult::Type::NUM,
"pingwait",
true,
"The duration in milliseconds (ms) of an outstanding ping (if non-zero)"},
154 {
RPCResult::Type::BOOL,
"bip152_hb_to",
"Whether we selected peer as (compact blocks) high-bandwidth peer"},
155 {
RPCResult::Type::BOOL,
"bip152_hb_from",
"Whether peer selected us as (compact blocks) high-bandwidth peer"},
157 {
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"},
164 {
RPCResult::Type::BOOL,
"addr_relay_enabled",
"Whether we participate in address relay with this peer"},
165 {
RPCResult::Type::NUM,
"addr_processed",
"The total number of addresses processed, excluding those dropped due to rate limiting"},
166 {
RPCResult::Type::NUM,
"addr_rate_limited",
"The total number of addresses dropped due to rate limiting"},
167 {
RPCResult::Type::ARR,
"permissions",
"Any special permissions that have been granted to this peer",
171 {
RPCResult::Type::NUM,
"minfeefilter",
"The minimum fee rate for transactions this peer accepts"},
175 "When a message type is not listed in this json object, the bytes sent are 0.\n"
176 "Only known message types can appear as keys in the object."}
181 "When a message type is not listed in this json object, the bytes received are 0.\n"
182 "Only known message types can appear as keys in the object and all bytes received\n"
186 "Please note this output is unlikely to be stable in upcoming releases as we iterate to\n"
187 "best capture connection behaviors."},
189 {
RPCResult::Type::STR,
"session_id",
"The session ID for this connection, or \"\" if there is none (\"v2\" transport protocol only).\n"},
203 std::vector<CNodeStats> vstats;
220 obj.
pushKV(
"id", stats.nodeid);
221 obj.
pushKV(
"addr", stats.m_addr_name);
222 if (stats.addrBind.IsValid()) {
223 obj.
pushKV(
"addrbind", stats.addrBind.ToStringAddrPort());
225 if (!(stats.addrLocal.empty())) {
226 obj.
pushKV(
"addrlocal", stats.addrLocal);
229 if (stats.m_mapped_as != 0) {
230 obj.
pushKV(
"mapped_as", uint64_t(stats.m_mapped_as));
240 obj.
pushKV(
"bytessent", stats.nSendBytes);
241 obj.
pushKV(
"bytesrecv", stats.nRecvBytes);
244 if (stats.m_last_ping_time > 0us) {
245 obj.
pushKV(
"pingtime", Ticks<SecondsDouble>(stats.m_last_ping_time));
247 if (stats.m_min_ping_time < std::chrono::microseconds::max()) {
248 obj.
pushKV(
"minping", Ticks<SecondsDouble>(stats.m_min_ping_time));
253 obj.
pushKV(
"version", stats.nVersion);
257 obj.
pushKV(
"subver", stats.cleanSubVer);
258 obj.
pushKV(
"inbound", stats.fInbound);
259 obj.
pushKV(
"bip152_hb_to", stats.m_bip152_highbandwidth_to);
260 obj.
pushKV(
"bip152_hb_from", stats.m_bip152_highbandwidth_from);
269 obj.
pushKV(
"inflight", std::move(heights));
277 obj.
pushKV(
"permissions", std::move(permissions));
281 for (
const auto& i : stats.mapSendBytesPerMsgType) {
283 sendPerMsgType.
pushKV(i.first, i.second);
285 obj.
pushKV(
"bytessent_per_msg", std::move(sendPerMsgType));
288 for (
const auto& i : stats.mapRecvBytesPerMsgType) {
290 recvPerMsgType.
pushKV(i.first, i.second);
292 obj.
pushKV(
"bytesrecv_per_msg", std::move(recvPerMsgType));
295 obj.
pushKV(
"session_id", stats.m_session_id);
297 ret.push_back(std::move(obj));
308 "\nAttempts to add or remove a node from the addnode list.\n"
309 "Or try a connection to a node once.\n"
310 "Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be\n"
311 "full nodes/support SegWit as other outbound peers are (though such peers will not be synced from).\n" +
313 " and are counted separately from the -maxconnections limit.\n",
322 +
HelpExampleRpc(
"addnode",
"\"192.168.0.6:8333\", \"onetry\" true")
326 const auto command{self.
Arg<std::string>(
"command")};
328 throw std::runtime_error(
335 const auto node_arg{self.
Arg<std::string>(
"node")};
337 bool use_v2transport = self.
MaybeArg<
bool>(
"v2transport").value_or(node_v2transport);
339 if (use_v2transport && !node_v2transport) {
352 if (!connman.
AddNode({node_arg, use_v2transport})) {
371 "\nOpen an outbound connection to a specified node. This RPC is for testing only.\n",
384 HelpExampleCli(
"addconnection",
"\"192.168.0.6:8333\" \"outbound-full-relay\" true")
385 +
HelpExampleRpc(
"addconnection",
"\"192.168.0.6:8333\" \"outbound-full-relay\" true")
390 throw std::runtime_error(
"addconnection is for regression testing (-regtest mode) only.");
393 const std::string address = request.params[0].get_str();
394 const std::string conn_type_in{
TrimString(request.params[1].get_str())};
396 if (conn_type_in ==
"outbound-full-relay") {
398 }
else if (conn_type_in ==
"block-relay-only") {
400 }
else if (conn_type_in ==
"addr-fetch") {
402 }
else if (conn_type_in ==
"feeler") {
407 bool use_v2transport{self.
Arg<
bool>(
"v2transport")};
416 const bool success = connman.
AddConnection(address, conn_type, use_v2transport);
422 info.
pushKV(
"address", address);
423 info.
pushKV(
"connection_type", conn_type_in);
433 "\nImmediately disconnects from the specified peer node.\n"
434 "\nStrictly one out of 'address' and 'nodeid' can be provided to identify the node.\n"
435 "\nTo disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.\n",
453 const UniValue &address_arg = request.params[0];
454 const UniValue &id_arg = request.params[1];
479 "\nReturns information about the given added node, or all added nodes\n"
480 "(note that onetry addnodes are not listed here)\n",
513 if (!request.params[0].isNull()) {
516 if (info.m_params.m_added_node == request.params[0].get_str()) {
517 vInfo.assign(1, info);
531 obj.
pushKV(
"addednode", info.m_params.m_added_node);
532 obj.
pushKV(
"connected", info.fConnected);
534 if (info.fConnected) {
536 address.
pushKV(
"address", info.resolvedAddress.ToStringAddrPort());
537 address.
pushKV(
"connected", info.fInbound ?
"inbound" :
"outbound");
540 obj.
pushKV(
"addresses", std::move(addresses));
541 ret.push_back(std::move(obj));
552 "Returns information about network traffic, including bytes in, bytes out,\n"
553 "and current system time.",
584 obj.
pushKV(
"timemillis", TicksSinceEpoch<std::chrono::milliseconds>(SystemClock::now()));
593 obj.
pushKV(
"uploadtarget", std::move(outboundLimit));
602 for (
int n = 0; n <
NET_MAX; ++n) {
621 "Returns an object containing various state info regarding P2P networking.\n",
630 {
RPCResult::Type::ARR,
"localservicesnames",
"the services we offer to the network, in human-readable form",
647 {
RPCResult::Type::STR,
"proxy",
"(\"host:port\") the proxy that is used for this network, or empty if none"},
664 RPCResult{
RPCResult::Type::ARR,
"warnings",
"any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)",
690 auto peerman_info{
node.peerman->GetInfo()};
691 obj.
pushKV(
"localrelay", !peerman_info.ignores_incoming_txs);
692 obj.
pushKV(
"timeoffset", Ticks<std::chrono::seconds>(peerman_info.median_outbound_time_offset));
695 obj.
pushKV(
"networkactive",
node.connman->GetNetworkActive());
709 for (
const std::pair<const CNetAddr, LocalServiceInfo> &item : mapLocalHost)
712 rec.
pushKV(
"address", item.first.ToStringAddr());
713 rec.
pushKV(
"port", item.second.nPort);
714 rec.
pushKV(
"score", item.second.nScore);
715 localAddresses.
push_back(std::move(rec));
718 obj.
pushKV(
"localaddresses", std::move(localAddresses));
728 "\nAttempts to add or remove an IP/Subnet from the banned list.\n",
732 {
"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)"},
743 std::string strCommand;
744 if (!request.params[1].isNull())
745 strCommand = request.params[1].
get_str();
746 if (strCommand !=
"add" && strCommand !=
"remove") {
754 bool isSubnet =
false;
756 if (request.params[0].get_str().find(
'/') != std::string::npos)
760 const std::optional<CNetAddr> addr{
LookupHost(request.params[0].get_str(),
false)};
761 if (addr.has_value()) {
771 if (strCommand ==
"add")
778 if (!request.params[2].isNull())
779 banTime = request.params[2].getInt<int64_t>();
781 const bool absolute{request.params[3].isNull() ? false : request.params[3].get_bool()};
790 node.connman->DisconnectNode(subNet);
795 node.connman->DisconnectNode(netAddr);
799 else if(strCommand ==
"remove")
801 if (!( isSubnet ? banman.
Unban(subNet) : banman.
Unban(netAddr) )) {
813 "\nList all manually banned IPs/Subnets.\n",
836 const int64_t current_time{
GetTime()};
839 for (
const auto& entry : banMap)
841 const CBanEntry& banEntry = entry.second;
843 rec.
pushKV(
"address", entry.first.ToString());
849 bannedAddresses.
push_back(std::move(rec));
852 return bannedAddresses;
860 "\nClear all banned IPs.\n",
881 "\nDisable/enable all p2p network activity.\n",
902 "Return known addresses, after filtering for quality and recency.\n"
903 "These can potentially be used to find new peers in the network.\n"
904 "The total number of addresses known to the node may be higher.",
925 +
HelpExampleCli(
"-named getnodeaddresses",
"network=onion count=12")
934 const int count{request.params[0].isNull() ? 1 : request.params[0].getInt<
int>()};
937 const std::optional<Network> network{request.params[1].isNull() ? std::nullopt : std::optional<Network>{
ParseNetwork(request.params[1].get_str())}};
946 for (
const CAddress& addr : vAddr) {
948 obj.
pushKV(
"time", int64_t{TicksSinceEpoch<std::chrono::seconds>(addr.nTime)});
949 obj.
pushKV(
"services", (uint64_t)addr.nServices);
950 obj.
pushKV(
"address", addr.ToStringAddr());
951 obj.
pushKV(
"port", addr.GetPort());
953 ret.push_back(std::move(obj));
963 "Add the address of a potential peer to an address manager table. This RPC is for testing only.",
972 {
RPCResult::Type::BOOL,
"success",
"whether the peer address was successfully added to the address manager table"},
984 const std::string& addr_string{request.params[0].get_str()};
985 const auto port{request.params[1].getInt<uint16_t>()};
986 const bool tried{request.params[2].isNull() ? false : request.params[2].get_bool()};
989 std::optional<CNetAddr> net_addr{
LookupHost(addr_string,
false)};
992 if (net_addr.has_value()) {
993 CService service{net_addr.value(), port};
995 address.nTime = Now<NodeSeconds>();
998 if (addrman.
Add({address}, address)) {
1002 if (!addrman.
Good(address)) {
1004 obj.
pushKV(
"error",
"failed-adding-to-tried");
1008 obj.
pushKV(
"error",
"failed-adding-to-new");
1012 obj.
pushKV(
"success", success);
1022 "Send a p2p message to a peer specified by id.\n"
1023 "The message type and body must be provided, the message header will be generated.\n"
1024 "This RPC is for testing only.",
1034 const NodeId peer_id{request.params[0].
getInt<int64_t>()};
1035 const std::string& msg_type{request.params[1].get_str()};
1039 auto msg{TryParseHex<unsigned char>(request.params[2].get_str())};
1040 if (!
msg.has_value()) {
1049 msg_ser.
m_type = msg_type;
1070 "\nProvides information about the node's address manager by returning the number of "
1071 "addresses in the `new` and `tried` tables and their sum for all networks.\n",
1076 {
RPCResult::Type::NUM,
"new",
"number of addresses in the new table, which represent potential peers the node has discovered but hasn't yet successfully connected to."},
1077 {
RPCResult::Type::NUM,
"tried",
"number of addresses in the tried table, which represent peers the node has successfully connected to in the past."},
1086 for (
int n = 0; n <
NET_MAX; ++n) {
1090 obj.
pushKV(
"new", addrman.
Size(network,
true));
1091 obj.
pushKV(
"tried", addrman.
Size(network,
false));
1096 obj.
pushKV(
"new", addrman.
Size(std::nullopt,
true));
1097 obj.
pushKV(
"tried", addrman.
Size(std::nullopt,
false));
1099 ret.pushKV(
"all_networks", std::move(obj));
1109 const uint32_t mapped_as{connman.
GetMappedAS(info)};
1111 ret.pushKV(
"mapped_as", mapped_as);
1115 ret.pushKV(
"time", int64_t{TicksSinceEpoch<std::chrono::seconds>(info.
nTime)});
1120 if (source_mapped_as) {
1121 ret.pushKV(
"source_mapped_as", source_mapped_as);
1129 for (
const auto& e : tableInfos) {
1132 std::ostringstream key;
1145 "EXPERIMENTAL warning: this call may be changed in future releases.\n"
1146 "\nReturns information on all address manager entries for the new and tried tables.\n",
1151 {
RPCResult::Type::OBJ,
"bucket/position",
"the location in the address manager table (<bucket>/<position>)", {
1153 {
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)"},
1160 {
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)"}
1204 for (
const auto& c : commands) {
1205 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.
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 ForNode(NodeId id, std::function< bool(CNode *pnode)> func)
bool RemoveAddedNode(const std::string &node) EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex)
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)
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)
bool DisconnectNode(const std::string &node)
bool AddConnection(const std::string &address, ConnectionType conn_type, bool use_v2transport) EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex)
Attempts to open a connection.
std::vector< AddedNodeInfo > GetAddedNodeInfo(bool include_connected) const EXCLUSIVE_LOCKS_REQUIRED(!m_added_nodes_mutex)
size_t GetNodeCount(ConnectionDirection) const
uint32_t GetMappedAS(const CNetAddr &addr) const
void GetNodeStats(std::vector< CNodeStats > &vstats) const
uint64_t GetTotalBytesRecv() const
void SetNetworkActive(bool active)
std::chrono::seconds GetMaxOutboundTimeLeftInCycle() const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex)
std::vector< CAddress > GetAddresses(size_t max_addresses, size_t max_pct, std::optional< Network > network, const bool filtered=true) const
Return all or many randomly selected addresses, optionally by network.
void OpenNetworkConnection(const CAddress &addrConnect, bool fCountFailure, CSemaphoreGrant &&grant_outbound, const char *strDest, ConnectionType conn_type, bool use_v2transport) EXCLUSIVE_LOCKS_REQUIRED(!m_unused_i2p_sessions_mutex)
uint64_t GetTotalBytesSent() const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_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)
Network GetNetClass() const
std::string ToStringAddr() const
Information about a peer.
A combination of a network address (CNetAddr) and a (TCP) port.
static std::vector< std::string > ToStrings(NetPermissionFlags flags)
virtual void SendPings()=0
Send ping message to all peers.
virtual bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) const =0
Get statistics from node state.
std::string ToString() const
bool m_randomize_credentials
std::string ToString() const
auto Arg(std::string_view key) const
Helper to get a required or default-valued request argument.
auto MaybeArg(std::string_view key) const
Helper to get an optional request argument.
bool Contains(Network net) const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
void push_back(UniValue val)
const std::string & get_str() const
void pushKVEnd(std::string key, UniValue val)
void pushKV(std::string key, UniValue val)
static const int CLIENT_VERSION
bitcoind-res.rc includes this file, but it cannot cope with real c++ code.
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 absolute(const path &p)
UniValue GetWarningsForRpc(const Warnings &warnings, bool use_deprecated)
RPC helper function that wraps warnings.GetMessages().
std::string TrimString(std::string_view str, 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
static const 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
bool GetProxy(enum Network net, Proxy &proxyInfoOut)
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
static const 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 RPCHelpMan getnetworkinfo()
static RPCHelpMan addconnection()
static RPCHelpMan getaddednodeinfo()
static RPCHelpMan clearbanned()
static RPCHelpMan getnettotals()
static RPCHelpMan getaddrmaninfo()
static RPCHelpMan addnode()
static RPCHelpMan getnodeaddresses()
static RPCHelpMan setban()
static RPCHelpMan getrawaddrman()
static UniValue GetNetworksInfo()
UniValue AddrmanTableToJSON(const std::vector< std::pair< AddrInfo, AddressPosition > > &tableInfos, const CConnman &connman)
static RPCHelpMan getconnectioncount()
static RPCHelpMan disconnectnode()
static RPCHelpMan listbanned()
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 RPCHelpMan setnetworkactive()
static RPCHelpMan addpeeraddress()
static RPCHelpMan getpeerinfo()
UniValue AddrmanEntryToJSON(const AddrInfo &info, const CConnman &connman)
static RPCHelpMan sendmsgtopeer()
@ 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)
CConnman & EnsureConnman(const NodeContext &node)
Location information for an address in AddrMan.
std::chrono::microseconds m_ping_wait
std::vector< int > vHeightInFlight
CAmount m_fee_filter_received
std::chrono::seconds time_offset
bool m_addr_relay_enabled
uint64_t m_addr_rate_limited
uint64_t m_addr_processed
ServiceFlags their_services
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.
NodeContext struct containing references to chain state and connection state.
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)