From 54cf99745ffa8f437c63f9f86c5c9d5e6bb04028 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sun, 23 Oct 2016 05:35:52 +0000 Subject: RPC/Net: Use boolean consistently for networkactive, and remove from getinfo --- src/rpc/misc.cpp | 4 +--- src/rpc/net.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src/rpc') diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 4bfcc9387c..5afcf6353c 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -89,10 +89,8 @@ UniValue getinfo(const UniValue& params, bool fHelp) #endif obj.push_back(Pair("blocks", (int)chainActive.Height())); obj.push_back(Pair("timeoffset", GetTimeOffset())); - if (g_connman) { - obj.push_back(Pair("networkactive", g_connman->GetNetworkActive())); + if(g_connman) obj.push_back(Pair("connections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL))); - } obj.push_back(Pair("proxy", (proxy.IsValid() ? proxy.proxy.ToStringIPPort() : string()))); obj.push_back(Pair("difficulty", (double)GetDifficulty())); obj.push_back(Pair("testnet", Params().TestnetToBeDeprecatedFieldRPC())); diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 045089e2e5..c470a546b9 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -401,7 +401,7 @@ UniValue getnetworkinfo(const UniValue& params, bool fHelp) " \"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" - " \"networkactive\": x, (numeric) the number of connections\n" + " \"networkactive\": true|false, (bool) whether p2p networking is enabled\n" " \"networks\": [ (array) information per network\n" " {\n" " \"name\": \"xxx\", (string) network (ipv4, ipv6 or onion)\n" @@ -437,7 +437,7 @@ UniValue getnetworkinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("localrelay", fRelayTxes)); obj.push_back(Pair("timeoffset", GetTimeOffset())); if (g_connman) { - obj.push_back(Pair("networkactive", (int)g_connman->GetNetworkActive())); + obj.push_back(Pair("networkactive", g_connman->GetNetworkActive())); obj.push_back(Pair("connections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL))); } obj.push_back(Pair("networks", GetNetworksInfo())); @@ -578,8 +578,8 @@ UniValue setnetworkactive(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 1) { throw runtime_error( - "setnetworkactive \"true|false\"\n" - "Disable/Re-Enable all network activity temporarily." + "setnetworkactive true|false\n" + "Disable/enable all p2p network activity." ); } -- cgit v1.2.3