aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/net.cpp
diff options
context:
space:
mode:
authorAmiti Uttarwar <amiti@uttarwar.org>2020-08-12 13:57:13 -0700
committerAmiti Uttarwar <amiti@uttarwar.org>2020-09-21 19:01:29 -0700
commit395acfa83a5436790c1a722a5609ac9d48df235f (patch)
tree523f1a77f69da9ff7e44f4bc602bbaf2dc14aa2b /src/rpc/net.cpp
parent49c10a9ca40967d28ae16dfea9cccc6f3a6624a1 (diff)
downloadbitcoin-395acfa83a5436790c1a722a5609ac9d48df235f.tar.xz
[rpc] Add connection type to getpeerinfo RPC, update tests
Diffstat (limited to 'src/rpc/net.cpp')
-rw-r--r--src/rpc/net.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp
index 5af4389857..e480bd2a40 100644
--- a/src/rpc/net.cpp
+++ b/src/rpc/net.cpp
@@ -113,6 +113,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
{RPCResult::Type::STR, "subver", "The string version"},
{RPCResult::Type::BOOL, "inbound", "Inbound (true) or Outbound (false)"},
{RPCResult::Type::BOOL, "addnode", "Whether connection was due to addnode/-connect or if it was an automatic/inbound connection"},
+ {RPCResult::Type::STR, "connection_type", "Type of connection: \n" + Join(CONNECTION_TYPE_DOC, ",\n") + "."},
{RPCResult::Type::NUM, "startingheight", "The starting height (block) of the peer"},
{RPCResult::Type::NUM, "banscore", "The ban score (DEPRECATED, returned only if config option -deprecatedrpc=banscore is passed)"},
{RPCResult::Type::NUM, "synced_headers", "The last header we have in common with this peer"},
@@ -228,6 +229,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
recvPerMsgCmd.pushKV(i.first, i.second);
}
obj.pushKV("bytesrecv_per_msg", recvPerMsgCmd);
+ obj.pushKV("connection_type", stats.m_conn_type_string);
ret.push_back(obj);
}