MCPcopy Create free account
hub / github.com/ElementsProject/elements / getpeerinfo

Function getpeerinfo

src/rpc/net.cpp:92–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92static RPCHelpMan getpeerinfo()
93{
94 return RPCHelpMan{
95 "getpeerinfo",
96 "\nReturns data about each connected network node as a json array of objects.\n",
97 {},
98 RPCResult{
99 RPCResult::Type::ARR, "", "",
100 {
101 {RPCResult::Type::OBJ, "", "",
102 {
103 {
104 {RPCResult::Type::NUM, "id", "Peer index"},
105 {RPCResult::Type::STR, "addr", "(host:port) The IP address and port of the peer"},
106 {RPCResult::Type::STR, "addrbind", /*optional=*/true, "(ip:port) Bind address of the connection to the peer"},
107 {RPCResult::Type::STR, "addrlocal", /*optional=*/true, "(ip:port) Local address as reported by the peer"},
108 {RPCResult::Type::STR, "network", "Network (" + Join(GetNetworkNames(/* append_unroutable */ true), ", ") + ")"},
109 {RPCResult::Type::NUM, "mapped_as", /*optional=*/true, "The AS in the BGP route to the peer used for diversifying\n"
110 "peer selection (only available if the asmap config flag is set)"},
111 {RPCResult::Type::STR_HEX, "services", "The services offered"},
112 {RPCResult::Type::ARR, "servicesnames", "the services offered, in human-readable form",
113 {
114 {RPCResult::Type::STR, "SERVICE_NAME", "the service name if it is recognised"}
115 }},
116 {RPCResult::Type::BOOL, "relaytxes", "Whether peer has asked us to relay transactions to it"},
117 {RPCResult::Type::NUM_TIME, "lastsend", "The " + UNIX_EPOCH_TIME + " of the last send"},
118 {RPCResult::Type::NUM_TIME, "lastrecv", "The " + UNIX_EPOCH_TIME + " of the last receive"},
119 {RPCResult::Type::NUM_TIME, "last_transaction", "The " + UNIX_EPOCH_TIME + " of the last valid transaction received from this peer"},
120 {RPCResult::Type::NUM_TIME, "last_block", "The " + UNIX_EPOCH_TIME + " of the last block received from this peer"},
121 {RPCResult::Type::NUM, "bytessent", "The total bytes sent"},
122 {RPCResult::Type::NUM, "bytesrecv", "The total bytes received"},
123 {RPCResult::Type::NUM_TIME, "conntime", "The " + UNIX_EPOCH_TIME + " of the connection"},
124 {RPCResult::Type::NUM, "timeoffset", "The time offset in seconds"},
125 {RPCResult::Type::NUM, "pingtime", /*optional=*/true, "ping time (if available)"},
126 {RPCResult::Type::NUM, "minping", /*optional=*/true, "minimum observed ping time (if any at all)"},
127 {RPCResult::Type::NUM, "pingwait", /*optional=*/true, "ping wait (if non-zero)"},
128 {RPCResult::Type::NUM, "version", "The peer version, such as 70001"},
129 {RPCResult::Type::STR, "subver", "The string version"},
130 {RPCResult::Type::BOOL, "inbound", "Inbound (true) or Outbound (false)"},
131 {RPCResult::Type::BOOL, "bip152_hb_to", "Whether we selected peer as (compact blocks) high-bandwidth peer"},
132 {RPCResult::Type::BOOL, "bip152_hb_from", "Whether peer selected us as (compact blocks) high-bandwidth peer"},
133 {RPCResult::Type::NUM, "startingheight", /*optional=*/true, "The starting height (block) of the peer"},
134 {RPCResult::Type::NUM, "synced_headers", /*optional=*/true, "The last header we have in common with this peer"},
135 {RPCResult::Type::NUM, "synced_blocks", /*optional=*/true, "The last block we have in common with this peer"},
136 {RPCResult::Type::ARR, "inflight", /*optional=*/true, "",
137 {
138 {RPCResult::Type::NUM, "n", "The heights of blocks we're currently asking from this peer"},
139 }},
140 {RPCResult::Type::BOOL, "addr_relay_enabled", /*optional=*/true, "Whether we participate in address relay with this peer"},
141 {RPCResult::Type::NUM, "addr_processed", /*optional=*/true, "The total number of addresses processed, excluding those dropped due to rate limiting"},
142 {RPCResult::Type::NUM, "addr_rate_limited", /*optional=*/true, "The total number of addresses dropped due to rate limiting"},
143 {RPCResult::Type::ARR, "permissions", "Any special permissions that have been granted to this peer",
144 {
145 {RPCResult::Type::STR, "permission_type", Join(NET_PERMISSIONS_DOC, ",\n") + ".\n"},
146 }},
147 {RPCResult::Type::NUM, "minfeefilter", "The minimum fee rate for transactions this peer accepts"},
148 {RPCResult::Type::OBJ_DYN, "bytessent_per_msg", "",
149 {

Callers

nothing calls this directly

Calls 15

JoinFunction · 0.85
GetNetworkNamesFunction · 0.85
HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
GetNetworkNameFunction · 0.85
GetServicesNamesFunction · 0.85
count_secondsFunction · 0.85
CountSecondsDoubleFunction · 0.85
ValueFromAmountFunction · 0.85
ConnectionTypeAsStringFunction · 0.85
GetNodeStatsMethod · 0.80
GetNodeStateStatsMethod · 0.80

Tested by

no test coverage detected