aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2020-09-23 11:27:54 +0200
committerJon Atack <jon@atack.com>2020-10-14 14:56:03 +0200
commit4938a109adf13f2c60a50f08d4cc9ddb8d7ded96 (patch)
treed106b1b1d9463134825f6478589c7901c9916b38 /src/rpc
parent6df7882029854f0427d84b22081018ae77e27e66 (diff)
downloadbitcoin-4938a109adf13f2c60a50f08d4cc9ddb8d7ded96.tar.xz
rpc, test: expose CNodeStats network in RPC getpeerinfo
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/net.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp
index def21b119e..d095f538b4 100644
--- a/src/rpc/net.cpp
+++ b/src/rpc/net.cpp
@@ -94,6 +94,7 @@ static RPCHelpMan getpeerinfo()
{RPCResult::Type::STR, "addr", "(host:port) The IP address and port of the peer"},
{RPCResult::Type::STR, "addrbind", "(ip:port) Bind address of the connection to the peer"},
{RPCResult::Type::STR, "addrlocal", "(ip:port) Local address as reported by the peer"},
+ {RPCResult::Type::STR, "network", "Network (ipv4, ipv6, or onion) the peer connected through"},
{RPCResult::Type::NUM, "mapped_as", "The AS in the BGP route to the peer used for diversifying\n"
"peer selection (only available if the asmap config flag is set)"},
{RPCResult::Type::STR_HEX, "services", "The services offered"},
@@ -165,10 +166,13 @@ static RPCHelpMan getpeerinfo()
bool fStateStats = GetNodeStateStats(stats.nodeid, statestats);
obj.pushKV("id", stats.nodeid);
obj.pushKV("addr", stats.addrName);
- if (!(stats.addrLocal.empty()))
- obj.pushKV("addrlocal", stats.addrLocal);
- if (stats.addrBind.IsValid())
+ if (stats.addrBind.IsValid()) {
obj.pushKV("addrbind", stats.addrBind.ToString());
+ }
+ if (!(stats.addrLocal.empty())) {
+ obj.pushKV("addrlocal", stats.addrLocal);
+ }
+ obj.pushKV("network", stats.m_network);
if (stats.m_mapped_as != 0) {
obj.pushKV("mapped_as", uint64_t(stats.m_mapped_as));
}