diff --git a/doc/release-notes.md b/doc/release-notes.md --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -12,6 +12,8 @@ - The `getchaintxstats` RPC now returns the additional key of `window_final_block_height`. +- The `getnetworkinfo` and `getpeerinfo` commands now contain + a new `servicesnames` field with decoded network service flags. Updated settings ---------------- diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -95,6 +95,12 @@ "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 " + @@ -195,6 +201,7 @@ 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); @@ -553,6 +560,12 @@ "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 " @@ -611,8 +624,9 @@ obj.pushKV("subversion", userAgent(config)); obj.pushKV("protocolversion", PROTOCOL_VERSION); if (g_rpc_node->connman) { - obj.pushKV("localservices", - strprintf("%016x", g_rpc_node->connman->GetLocalServices())); + ServiceFlags services = g_rpc_node->connman->GetLocalServices(); + obj.pushKV("localservices", strprintf("%016x", services)); + obj.pushKV("localservicesnames", GetServicesNames(services)); } obj.pushKV("localrelay", g_relay_txes); obj.pushKV("timeoffset", GetTimeOffset()); diff --git a/src/rpc/util.h b/src/rpc/util.h --- a/src/rpc/util.h +++ b/src/rpc/util.h @@ -7,6 +7,7 @@ #include #include +#include #include #include #include