aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2020-06-29 10:04:08 +0200
committerJon Atack <jon@atack.com>2020-08-24 18:41:14 +0200
commit1ab49b81cf32b6ef9e312a0a8ac45c68a3262f0d (patch)
treefa8c969204b4389f0f45277bcae12c68fd808b91 /src/rpc
parent7f609f68d835bece8b01da1b09b127c67769ae7d (diff)
downloadbitcoin-1ab49b81cf32b6ef9e312a0a8ac45c68a3262f0d.tar.xz
Add in/out connections to rpc getnetworkinfo
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/net.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp
index e9343b3348..e4fe021c3f 100644
--- a/src/rpc/net.cpp
+++ b/src/rpc/net.cpp
@@ -490,7 +490,9 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request)
}},
{RPCResult::Type::BOOL, "localrelay", "true if transaction relay is requested from peers"},
{RPCResult::Type::NUM, "timeoffset", "the time offset"},
- {RPCResult::Type::NUM, "connections", "the number of connections"},
+ {RPCResult::Type::NUM, "connections", "the total number of connections"},
+ {RPCResult::Type::NUM, "connections_in", "the number of inbound connections"},
+ {RPCResult::Type::NUM, "connections_out", "the number of outbound connections"},
{RPCResult::Type::BOOL, "networkactive", "whether p2p networking is enabled"},
{RPCResult::Type::ARR, "networks", "information per network",
{
@@ -538,7 +540,9 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request)
obj.pushKV("timeoffset", GetTimeOffset());
if (node.connman) {
obj.pushKV("networkactive", node.connman->GetNetworkActive());
- obj.pushKV("connections", (int)node.connman->GetNodeCount(CConnman::CONNECTIONS_ALL));
+ obj.pushKV("connections", (int)node.connman->GetNodeCount(CConnman::CONNECTIONS_ALL));
+ obj.pushKV("connections_in", (int)node.connman->GetNodeCount(CConnman::CONNECTIONS_IN));
+ obj.pushKV("connections_out", (int)node.connman->GetNodeCount(CConnman::CONNECTIONS_OUT));
}
obj.pushKV("networks", GetNetworksInfo());
obj.pushKV("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK()));