aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-06-21 18:05:28 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-06-21 19:26:18 +0200
commit540ce6aa10996661a62853797538d2a703664ea2 (patch)
tree4f0861b70096ee57e51a53d2325466619e074ab3 /src
parentaaacfa089868a3bce7a2878ce86f642a410aebb1 (diff)
parent38405ac1411ce73f6945f296980d559e2949027f (diff)
downloadbitcoin-540ce6aa10996661a62853797538d2a703664ea2.tar.xz
Merge pull request #4380
38405ac Add comment regarding experimental-use service bits (Peter Todd) 99ddc6c Add nLocalServices info to RPC getinfo (Peter Todd)
Diffstat (limited to 'src')
-rw-r--r--src/protocol.h8
-rw-r--r--src/rpcnet.cpp6
2 files changed, 12 insertions, 2 deletions
diff --git a/src/protocol.h b/src/protocol.h
index 6de5d05a72..1f23274299 100644
--- a/src/protocol.h
+++ b/src/protocol.h
@@ -64,6 +64,14 @@ class CMessageHeader
enum
{
NODE_NETWORK = (1 << 0),
+
+ // Bits 24-31 are reserved for temporary experiments. Just pick a bit that
+ // isn't getting used, or one not being used much, and notify the
+ // bitcoin-development mailing list. Remember that service bits are just
+ // unauthenticated advertisements, so your code must be robust against
+ // collisions and other cases where nodes may be advertising a service they
+ // do not actually support. Other service bits should be allocated via the
+ // BIP process.
};
/** A CService with information about it as peer */
diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp
index 0eca55a472..6fc86eedfb 100644
--- a/src/rpcnet.cpp
+++ b/src/rpcnet.cpp
@@ -80,7 +80,7 @@ Value getpeerinfo(const Array& params, bool fHelp)
" {\n"
" \"addr\":\"host:port\", (string) The ip address and port of the peer\n"
" \"addrlocal\":\"ip:port\", (string) local address\n"
- " \"services\":\"00000001\", (string) The services\n"
+ " \"services\":\"xxxxxxxxxxxxxxxx\", (string) The services offered\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"
" \"bytessent\": n, (numeric) The total bytes sent\n"
@@ -115,7 +115,7 @@ Value getpeerinfo(const Array& params, bool fHelp)
obj.push_back(Pair("addr", stats.addrName));
if (!(stats.addrLocal.empty()))
obj.push_back(Pair("addrlocal", stats.addrLocal));
- obj.push_back(Pair("services", strprintf("%08x", stats.nServices)));
+ obj.push_back(Pair("services", strprintf("%016x", stats.nServices)));
obj.push_back(Pair("lastsend", stats.nLastSend));
obj.push_back(Pair("lastrecv", stats.nLastRecv));
obj.push_back(Pair("bytessent", stats.nSendBytes));
@@ -344,6 +344,7 @@ Value getnetworkinfo(const Array& params, bool fHelp)
"{\n"
" \"version\": xxxxx, (numeric) the server version\n"
" \"protocolversion\": xxxxx, (numeric) the protocol version\n"
+ " \"localservices\": \"xxxxxxxxxxxxxxxx\", (string) the services we offer to the network\n"
" \"timeoffset\": xxxxx, (numeric) the time offset\n"
" \"connections\": xxxxx, (numeric) the number of connections\n"
" \"proxy\": \"host:port\", (string, optional) the proxy used by the server\n"
@@ -365,6 +366,7 @@ Value getnetworkinfo(const Array& params, bool fHelp)
Object obj;
obj.push_back(Pair("version", (int)CLIENT_VERSION));
obj.push_back(Pair("protocolversion",(int)PROTOCOL_VERSION));
+ obj.push_back(Pair("localservices", strprintf("%016x", nLocalServices)));
obj.push_back(Pair("timeoffset", GetTimeOffset()));
obj.push_back(Pair("connections", (int)vNodes.size()));
obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string())));