diff options
author | Gleb Naumenko <naumenko.gs@gmail.com> | 2019-12-24 13:26:46 -0500 |
---|---|---|
committer | Gleb Naumenko <naumenko.gs@gmail.com> | 2020-01-23 14:22:56 -0500 |
commit | e4658aa8eaf1629dd5af8cf7b9717a8e72028251 (patch) | |
tree | 1f2ba6f5bfca20d4780d23fb074bdb449796327f /src/rpc/net.cpp | |
parent | ec45646de9e62b3d42c85716bfeb06d8f2b507dc (diff) |
Return mapped AS in RPC call getpeerinfo
If ASN bucketing is used, return a corresponding AS
used in bucketing for a given peer.
Diffstat (limited to 'src/rpc/net.cpp')
-rw-r--r-- | src/rpc/net.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index f1dcc9b607..16ee911c0b 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -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); |