|
|
@ -401,6 +401,7 @@ UniValue getnetworkinfo(const UniValue& params, bool fHelp)
|
|
|
|
" \"localrelay\": true|false, (bool) true if transaction relay is requested from peers\n"
|
|
|
|
" \"localrelay\": true|false, (bool) true if transaction relay is requested from peers\n"
|
|
|
|
" \"timeoffset\": xxxxx, (numeric) the time offset\n"
|
|
|
|
" \"timeoffset\": xxxxx, (numeric) the time offset\n"
|
|
|
|
" \"connections\": xxxxx, (numeric) the number of connections\n"
|
|
|
|
" \"connections\": xxxxx, (numeric) the number of connections\n"
|
|
|
|
|
|
|
|
" \"networkactive\": x, (numeric) the number of connections\n"
|
|
|
|
" \"networks\": [ (array) information per network\n"
|
|
|
|
" \"networks\": [ (array) information per network\n"
|
|
|
|
" {\n"
|
|
|
|
" {\n"
|
|
|
|
" \"name\": \"xxx\", (string) network (ipv4, ipv6 or onion)\n"
|
|
|
|
" \"name\": \"xxx\", (string) network (ipv4, ipv6 or onion)\n"
|
|
|
@ -435,8 +436,10 @@ UniValue getnetworkinfo(const UniValue& params, bool fHelp)
|
|
|
|
obj.push_back(Pair("localservices", strprintf("%016x", g_connman->GetLocalServices())));
|
|
|
|
obj.push_back(Pair("localservices", strprintf("%016x", g_connman->GetLocalServices())));
|
|
|
|
obj.push_back(Pair("localrelay", fRelayTxes));
|
|
|
|
obj.push_back(Pair("localrelay", fRelayTxes));
|
|
|
|
obj.push_back(Pair("timeoffset", GetTimeOffset()));
|
|
|
|
obj.push_back(Pair("timeoffset", GetTimeOffset()));
|
|
|
|
if(g_connman)
|
|
|
|
if (g_connman) {
|
|
|
|
|
|
|
|
obj.push_back(Pair("networkactive", (int)g_connman->GetNetworkActive()));
|
|
|
|
obj.push_back(Pair("connections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL)));
|
|
|
|
obj.push_back(Pair("connections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL)));
|
|
|
|
|
|
|
|
}
|
|
|
|
obj.push_back(Pair("networks", GetNetworksInfo()));
|
|
|
|
obj.push_back(Pair("networks", GetNetworksInfo()));
|
|
|
|
obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK())));
|
|
|
|
obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK())));
|
|
|
|
UniValue localAddresses(UniValue::VARR);
|
|
|
|
UniValue localAddresses(UniValue::VARR);
|
|
|
@ -571,12 +574,12 @@ UniValue clearbanned(const UniValue& params, bool fHelp)
|
|
|
|
return NullUniValue;
|
|
|
|
return NullUniValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UniValue togglenetwork(const JSONRPCRequest& request)
|
|
|
|
UniValue setnetworkactive(const JSONRPCRequest& request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (request.fHelp || request.params.size() != 0) {
|
|
|
|
if (request.fHelp || request.params.size() != 1) {
|
|
|
|
throw runtime_error(
|
|
|
|
throw runtime_error(
|
|
|
|
"togglenetwork\n"
|
|
|
|
"setnetworkactive \"true|false\"\n"
|
|
|
|
"Toggle all network activity temporarily."
|
|
|
|
"Disable/Re-Enable all network activity temporarily."
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -584,7 +587,7 @@ UniValue togglenetwork(const JSONRPCRequest& request)
|
|
|
|
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
|
|
|
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
g_connman->SetNetworkActive(!g_connman->GetNetworkActive());
|
|
|
|
g_connman->SetNetworkActive(request.params[0].get_bool());
|
|
|
|
|
|
|
|
|
|
|
|
return g_connman->GetNetworkActive();
|
|
|
|
return g_connman->GetNetworkActive();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -603,7 +606,7 @@ static const CRPCCommand commands[] =
|
|
|
|
{ "network", "setban", &setban, true },
|
|
|
|
{ "network", "setban", &setban, true },
|
|
|
|
{ "network", "listbanned", &listbanned, true },
|
|
|
|
{ "network", "listbanned", &listbanned, true },
|
|
|
|
{ "network", "clearbanned", &clearbanned, true },
|
|
|
|
{ "network", "clearbanned", &clearbanned, true },
|
|
|
|
{ "network", "togglenetwork", &togglenetwork, true, },
|
|
|
|
{ "network", "setnetworkactive", &setnetworkactive, true, },
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void RegisterNetRPCCommands(CRPCTable &t)
|
|
|
|
void RegisterNetRPCCommands(CRPCTable &t)
|
|
|
|