aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/net.cpp
diff options
context:
space:
mode:
authordarosior <darosior@gmail.com>2019-03-01 17:06:27 +0100
committerdarosior <darosior@protonmail.com>2019-09-05 15:11:48 +0200
commit6564f58c87a84c88d07629e9d86e15f07d0ed837 (patch)
treed503b9c772a8ba8d6dfc1d17b7048f5ec2602fd0 /src/rpc/net.cpp
parent6519be605480fec95dcd814771038efcb1ad2abe (diff)
rpc/net: decode the services flags in a new entry
Diffstat (limited to 'src/rpc/net.cpp')
-rw-r--r--src/rpc/net.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp
index 25dda924a4..7c4b3d0cc6 100644
--- a/src/rpc/net.cpp
+++ b/src/rpc/net.cpp
@@ -82,6 +82,10 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
" \"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"
" \"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"
+ " ...\n"
+ " ],\n"
" \"relaytxes\":true|false, (boolean) Whether peer has asked us to relay transactions to it\n"
" \"lastsend\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last send\n"
" \"lastrecv\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last receive\n"
@@ -147,6 +151,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
if (stats.addrBind.IsValid())
obj.pushKV("addrbind", stats.addrBind.ToString());
obj.pushKV("services", strprintf("%016x", stats.nServices));
+ obj.pushKV("servicesnames", GetServicesNames(stats.nServices));
obj.pushKV("relaytxes", stats.fRelayTxes);
obj.pushKV("lastsend", stats.nLastSend);
obj.pushKV("lastrecv", stats.nLastRecv);
@@ -446,6 +451,10 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request)
" \"subversion\": \"/Satoshi:x.x.x/\", (string) the server subversion string\n"
" \"protocolversion\": xxxxx, (numeric) the protocol version\n"
" \"localservices\": \"xxxxxxxxxxxxxxxx\", (string) the services we offer to the network\n"
+ " \"localservicesnames\": [ (array) the services we offer to the network, in human-readable form\n"
+ " \"SERVICE_NAME\", (string) the service name\n"
+ " ...\n"
+ " ],\n"
" \"localrelay\": true|false, (bool) true if transaction relay is requested from peers\n"
" \"timeoffset\": xxxxx, (numeric) the time offset\n"
" \"connections\": xxxxx, (numeric) the number of connections\n"
@@ -484,8 +493,11 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request)
obj.pushKV("version", CLIENT_VERSION);
obj.pushKV("subversion", strSubVersion);
obj.pushKV("protocolversion",PROTOCOL_VERSION);
- if(g_connman)
- obj.pushKV("localservices", strprintf("%016x", g_connman->GetLocalServices()));
+ if (g_connman) {
+ ServiceFlags services = g_connman->GetLocalServices();
+ obj.pushKV("localservices", strprintf("%016x", services));
+ obj.pushKV("localservicesnames", GetServicesNames(services));
+ }
obj.pushKV("localrelay", g_relay_txes);
obj.pushKV("timeoffset", GetTimeOffset());
if (g_connman) {