aboutsummaryrefslogtreecommitdiff
path: root/src/rpcnet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpcnet.cpp')
-rw-r--r--src/rpcnet.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp
index 573d6cd3f6..cf2c293caf 100644
--- a/src/rpcnet.cpp
+++ b/src/rpcnet.cpp
@@ -9,6 +9,7 @@
#include "netbase.h"
#include "protocol.h"
#include "sync.h"
+#include "timedata.h"
#include "util.h"
#include <boost/foreach.hpp>
@@ -80,7 +81,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,12 +116,12 @@ 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("lastsend", (boost::int64_t)stats.nLastSend));
- obj.push_back(Pair("lastrecv", (boost::int64_t)stats.nLastRecv));
- obj.push_back(Pair("bytessent", (boost::int64_t)stats.nSendBytes));
- obj.push_back(Pair("bytesrecv", (boost::int64_t)stats.nRecvBytes));
- obj.push_back(Pair("conntime", (boost::int64_t)stats.nTimeConnected));
+ 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));
+ obj.push_back(Pair("bytesrecv", stats.nRecvBytes));
+ obj.push_back(Pair("conntime", stats.nTimeConnected));
obj.push_back(Pair("pingtime", stats.dPingTime));
if (stats.dPingWait > 0.0)
obj.push_back(Pair("pingwait", stats.dPingWait));
@@ -133,6 +134,7 @@ Value getpeerinfo(const Array& params, bool fHelp)
obj.push_back(Pair("startingheight", stats.nStartingHeight));
if (fStateStats) {
obj.push_back(Pair("banscore", statestats.nMisbehavior));
+ obj.push_back(Pair("syncheight", statestats.nSyncHeight));
}
obj.push_back(Pair("syncnode", stats.fSyncNode));
@@ -166,7 +168,7 @@ Value addnode(const Array& params, bool fHelp)
if (strCommand == "onetry")
{
CAddress addr;
- ConnectNode(addr, strNode.c_str());
+ OpenNetworkConnection(addr, NULL, strNode.c_str());
return Value::null;
}
@@ -328,9 +330,9 @@ Value getnettotals(const Array& params, bool fHelp)
);
Object obj;
- obj.push_back(Pair("totalbytesrecv", static_cast< boost::uint64_t>(CNode::GetTotalBytesRecv())));
- obj.push_back(Pair("totalbytessent", static_cast<boost::uint64_t>(CNode::GetTotalBytesSent())));
- obj.push_back(Pair("timemillis", static_cast<boost::int64_t>(GetTimeMillis())));
+ obj.push_back(Pair("totalbytesrecv", CNode::GetTotalBytesRecv()));
+ obj.push_back(Pair("totalbytessent", CNode::GetTotalBytesSent()));
+ obj.push_back(Pair("timemillis", GetTimeMillis()));
return obj;
}
@@ -344,6 +346,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,10 +368,11 @@ 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("timeoffset", (boost::int64_t)GetTimeOffset()));
+ 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())));
- obj.push_back(Pair("relayfee", ValueFromAmount(CTransaction::nMinRelayTxFee)));
+ obj.push_back(Pair("proxy", (proxy.IsValid() ? proxy.ToStringIPPort() : string())));
+ obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK())));
Array localAddresses;
{
LOCK(cs_mapLocalHost);