mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Return mapped AS in RPC call getpeerinfo
If ASN bucketing is used, return a corresponding AS used in bucketing for a given peer.
This commit is contained in:
@@ -83,6 +83,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
|
||||
" \"addr\":\"host:port\", (string) The IP address and port of the peer\n"
|
||||
" \"addrbind\":\"ip:port\", (string) Bind address of the connection to the peer\n"
|
||||
" \"addrlocal\":\"ip:port\", (string) Local address as reported by the peer\n"
|
||||
" \"mapped_as\":\"mapped_as\", (string) The AS in the BGP route to the peer used for diversifying peer selection\n"
|
||||
" \"services\":\"xxxxxxxxxxxxxxxx\", (string) The services offered\n"
|
||||
" \"servicesnames\":[ (array) the services offered, in human-readable form\n"
|
||||
" \"SERVICE_NAME\", (string) the service name if it is recognised\n"
|
||||
@@ -152,6 +153,9 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
|
||||
obj.pushKV("addrlocal", stats.addrLocal);
|
||||
if (stats.addrBind.IsValid())
|
||||
obj.pushKV("addrbind", stats.addrBind.ToString());
|
||||
if (stats.m_mapped_as != 0) {
|
||||
obj.pushKV("mapped_as", uint64_t(stats.m_mapped_as));
|
||||
}
|
||||
obj.pushKV("services", strprintf("%016x", stats.nServices));
|
||||
obj.pushKV("servicesnames", GetServicesNames(stats.nServices));
|
||||
obj.pushKV("relaytxes", stats.fRelayTxes);
|
||||
|
||||
Reference in New Issue
Block a user