MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / getpeerinfo

Function getpeerinfo

src/rpc/net.cpp:127–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127static RPCMethod getpeerinfo()
128{
129 return RPCMethod{
130 "getpeerinfo",
131 "Returns data about each connected network peer as a json array of objects.",
132 {},
133 RPCResult{
134 RPCResult::Type::ARR, "", "",
135 {
136 {RPCResult::Type::OBJ, "", "",
137 {
138 {
139 {RPCResult::Type::NUM, "id", "Peer index"},
140 {RPCResult::Type::STR, "addr", "(host:port) The IP address/hostname optionally followed by :port of the peer"},
141 {RPCResult::Type::STR, "addrbind", /*optional=*/true, "(ip:port) Bind address of the connection to the peer"},
142 {RPCResult::Type::STR, "addrlocal", /*optional=*/true, "(ip:port) Local address as reported by the peer"},
143 {RPCResult::Type::STR, "network", "Network (" + Join(GetNetworkNames(/*append_unroutable=*/true), ", ") + ")"},
144 {RPCResult::Type::NUM, "mapped_as", /*optional=*/true, "Mapped AS (Autonomous System) number at the end of the BGP route to the peer, used for diversifying\n"
145 "peer selection (only displayed if the -asmap config option is set)"},
146 {RPCResult::Type::STR_HEX, "services", "The services offered"},
147 {RPCResult::Type::ARR, "servicesnames", "the services offered, in human-readable form",
148 {
149 {RPCResult::Type::STR, "SERVICE_NAME", "the service name if it is recognised"}
150 }},
151 {RPCResult::Type::BOOL, "relaytxes", "Whether we relay transactions to this peer"},
152 {RPCResult::Type::NUM, "last_inv_sequence", "Mempool sequence number of this peer's last INV"},
153 {RPCResult::Type::NUM, "inv_to_send", "How many txs we have queued to announce to this peer"},
154 {RPCResult::Type::NUM_TIME, "lastsend", "The " + UNIX_EPOCH_TIME + " of the last send"},
155 {RPCResult::Type::NUM_TIME, "lastrecv", "The " + UNIX_EPOCH_TIME + " of the last receive"},
156 {RPCResult::Type::NUM_TIME, "last_transaction", "The " + UNIX_EPOCH_TIME + " of the last valid transaction received from this peer"},
157 {RPCResult::Type::NUM_TIME, "last_block", "The " + UNIX_EPOCH_TIME + " of the last block received from this peer"},
158 {RPCResult::Type::NUM, "bytessent", "The total bytes sent"},
159 {RPCResult::Type::NUM, "bytesrecv", "The total bytes received"},
160 {RPCResult::Type::NUM_TIME, "conntime", "The " + UNIX_EPOCH_TIME + " of the connection"},
161 {RPCResult::Type::NUM, "timeoffset", "The time offset in seconds"},
162 {RPCResult::Type::NUM, "pingtime", /*optional=*/true, "The last ping time in seconds, if any"},
163 {RPCResult::Type::NUM, "minping", /*optional=*/true, "The minimum observed ping time in seconds, if any"},
164 {RPCResult::Type::NUM, "pingwait", /*optional=*/true, "The duration in seconds of an outstanding ping (if non-zero)"},
165 {RPCResult::Type::NUM, "version", "The peer version, such as 70001"},
166 {RPCResult::Type::STR, "subver", "The string version"},
167 {RPCResult::Type::BOOL, "inbound", "Inbound (true) or Outbound (false)"},
168 {RPCResult::Type::BOOL, "bip152_hb_to", "Whether we selected peer as (compact blocks) high-bandwidth peer"},
169 {RPCResult::Type::BOOL, "bip152_hb_from", "Whether peer selected us as (compact blocks) high-bandwidth peer"},
170 {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"},
171 {RPCResult::Type::NUM, "synced_headers", "The last header we have in common with this peer"},
172 {RPCResult::Type::NUM, "synced_blocks", "The last block we have in common with this peer"},
173 {RPCResult::Type::ARR, "inflight", "",
174 {
175 {RPCResult::Type::NUM, "n", "The heights of blocks we're currently asking from this peer"},
176 }},
177 {RPCResult::Type::BOOL, "addr_relay_enabled", "Whether we participate in address relay with this peer"},
178 {RPCResult::Type::NUM, "addr_processed", "The total number of addresses processed, excluding those dropped due to rate limiting"},
179 {RPCResult::Type::NUM, "addr_rate_limited", "The total number of addresses dropped due to rate limiting"},
180 {RPCResult::Type::ARR, "permissions", "Any special permissions that have been granted to this peer",
181 {
182 {RPCResult::Type::STR, "permission_type", Join(NET_PERMISSIONS_DOC, ",\n") + ".\n"},
183 }},
184 {RPCResult::Type::NUM, "minfeefilter", "The minimum fee rate for transactions this peer accepts"},

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
ValueFromAmountFunction · 0.85
ConnectionTypeAsStringFunction · 0.85
TransportTypeAsStringFunction · 0.85
GetNodeStatsMethod · 0.80
GetNodeStateStatsMethod · 0.80

Tested by

no test coverage detected