Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/net.cpp
Show First 20 Lines • Show All 346 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 1) | ||||
" \"connected\" : \"outbound\" (string) " | " \"connected\" : \"outbound\" (string) " | ||||
"connection, inbound or outbound\n" | "connection, inbound or outbound\n" | ||||
" }\n" | " }\n" | ||||
" ]\n" | " ]\n" | ||||
" }\n" | " }\n" | ||||
" ,...\n" | " ,...\n" | ||||
"]\n" | "]\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("getaddednodeinfo", "true") + | HelpExampleCli("getaddednodeinfo", "\"192.168.0.201\"") + | ||||
HelpExampleCli("getaddednodeinfo", "true \"192.168.0.201\"") + | HelpExampleRpc("getaddednodeinfo", "\"192.168.0.201\"")); | ||||
HelpExampleRpc("getaddednodeinfo", "true, \"192.168.0.201\"")); | |||||
if (!g_connman) | if (!g_connman) | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_CLIENT_P2P_DISABLED, | RPC_CLIENT_P2P_DISABLED, | ||||
"Error: Peer-to-peer functionality missing or disabled"); | "Error: Peer-to-peer functionality missing or disabled"); | ||||
std::vector<AddedNodeInfo> vInfo = g_connman->GetAddedNodeInfo(); | std::vector<AddedNodeInfo> vInfo = g_connman->GetAddedNodeInfo(); | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | for (int n = 0; n < NET_MAX; ++n) { | ||||
enum Network network = static_cast<enum Network>(n); | enum Network network = static_cast<enum Network>(n); | ||||
if (network == NET_UNROUTABLE) continue; | if (network == NET_UNROUTABLE) continue; | ||||
proxyType proxy; | proxyType proxy; | ||||
UniValue obj(UniValue::VOBJ); | UniValue obj(UniValue::VOBJ); | ||||
GetProxy(network, proxy); | GetProxy(network, proxy); | ||||
obj.push_back(Pair("name", GetNetworkName(network))); | obj.push_back(Pair("name", GetNetworkName(network))); | ||||
obj.push_back(Pair("limited", IsLimited(network))); | obj.push_back(Pair("limited", IsLimited(network))); | ||||
obj.push_back(Pair("reachable", IsReachable(network))); | obj.push_back(Pair("reachable", IsReachable(network))); | ||||
obj.push_back(Pair("proxy", | obj.push_back(Pair("proxy", proxy.IsValid() | ||||
proxy.IsValid() ? proxy.proxy.ToStringIPPort() | ? proxy.proxy.ToStringIPPort() | ||||
: std::string())); | : std::string())); | ||||
obj.push_back( | obj.push_back( | ||||
Pair("proxy_randomize_credentials", proxy.randomize_credentials)); | Pair("proxy_randomize_credentials", proxy.randomize_credentials)); | ||||
networks.push_back(obj); | networks.push_back(obj); | ||||
} | } | ||||
return networks; | return networks; | ||||
} | } | ||||
static UniValue getnetworkinfo(const Config &config, | static UniValue getnetworkinfo(const Config &config, | ||||
Show All 38 Lines | if (request.fHelp || request.params.size() != 0) | ||||
" ,...\n" | " ,...\n" | ||||
" ],\n" | " ],\n" | ||||
" \"relayfee\": x.xxxxxxxx, (numeric) minimum " | " \"relayfee\": x.xxxxxxxx, (numeric) minimum " | ||||
"relay fee for non-free transactions in " + | "relay fee for non-free transactions in " + | ||||
CURRENCY_UNIT + | CURRENCY_UNIT + | ||||
"/kB\n" | "/kB\n" | ||||
" \"excessutxocharge\": x.xxxxxxxx, (numeric) minimum " | " \"excessutxocharge\": x.xxxxxxxx, (numeric) minimum " | ||||
"charge for excess utxos in " + | "charge for excess utxos in " + | ||||
CURRENCY_UNIT + "\n" | CURRENCY_UNIT + | ||||
"\n" | |||||
" \"incrementalfee\": x.xxxxxxxx, " | " \"incrementalfee\": x.xxxxxxxx, " | ||||
"(numeric) minimum fee increment for mempool " | "(numeric) minimum fee increment for mempool " | ||||
"limiting or BIP 125 replacement in " + | "limiting or BIP 125 replacement in " + | ||||
CURRENCY_UNIT + "/kB\n" | CURRENCY_UNIT + | ||||
"/kB\n" | |||||
" \"localaddresses\": [ " | " \"localaddresses\": [ " | ||||
"(array) list of local addresses\n" | "(array) list of local addresses\n" | ||||
" {\n" | " {\n" | ||||
" \"address\": \"xxxx\", " | " \"address\": \"xxxx\", " | ||||
"(string) network address\n" | "(string) network address\n" | ||||
" \"port\": xxx, " | " \"port\": xxx, " | ||||
"(numeric) network port\n" | "(numeric) network port\n" | ||||
" \"score\": xxx " | " \"score\": xxx " | ||||
"(numeric) relative score\n" | "(numeric) relative score\n" | ||||
" }\n" | " }\n" | ||||
" ,...\n" | " ,...\n" | ||||
" ]\n" | " ]\n" | ||||
" \"warnings\": \"...\" " | " \"warnings\": \"...\" " | ||||
"(string) any network warnings\n" | "(string) any network warnings\n" | ||||
"}\n" | "}\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("getnetworkinfo", "") + | HelpExampleCli("getnetworkinfo", "") + | ||||
HelpExampleRpc("getnetworkinfo", "")); | HelpExampleRpc("getnetworkinfo", "")); | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
UniValue obj(UniValue::VOBJ); | UniValue obj(UniValue::VOBJ); | ||||
obj.push_back(Pair("version", CLIENT_VERSION)); | obj.push_back(Pair("version", CLIENT_VERSION)); | ||||
obj.push_back(Pair("subversion", userAgent(config))); | obj.push_back(Pair("subversion", userAgent(config))); | ||||
obj.push_back(Pair("protocolversion", PROTOCOL_VERSION)); | obj.push_back(Pair("protocolversion", PROTOCOL_VERSION)); | ||||
if (g_connman) | if (g_connman) | ||||
obj.push_back(Pair("localservices", | obj.push_back(Pair("localservices", | ||||
strprintf("%016x", g_connman->GetLocalServices()))); | 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", g_connman->GetNetworkActive())); | obj.push_back(Pair("networkactive", g_connman->GetNetworkActive())); | ||||
obj.push_back( | obj.push_back(Pair("connections", (int)g_connman->GetNodeCount( | ||||
Pair("connections", | CConnman::CONNECTIONS_ALL))); | ||||
(int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL))); | |||||
} | } | ||||
obj.push_back(Pair("networks", GetNetworksInfo())); | obj.push_back(Pair("networks", GetNetworksInfo())); | ||||
obj.push_back( | obj.push_back( | ||||
Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK()))); | Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK()))); | ||||
obj.push_back(Pair("excessutxocharge", | obj.push_back(Pair("excessutxocharge", | ||||
ValueFromAmount(config.GetExcessUTXOCharge()))); | ValueFromAmount(config.GetExcessUTXOCharge()))); | ||||
obj.push_back(Pair("incrementalfee", | obj.push_back(Pair("incrementalfee", | ||||
ValueFromAmount(::incrementalRelayFee.GetFeePerK()))); | ValueFromAmount(::incrementalRelayFee.GetFeePerK()))); | ||||
▲ Show 20 Lines • Show All 200 Lines • Show Last 20 Lines |