mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Refactor: Remove using namespace <xxx> from rpc/
This commit is contained in:
@@ -23,12 +23,10 @@
|
||||
|
||||
#include <univalue.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
UniValue getconnectioncount(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 0)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"getconnectioncount\n"
|
||||
"\nReturns the number of connections to other nodes.\n"
|
||||
"\nResult:\n"
|
||||
@@ -47,7 +45,7 @@ UniValue getconnectioncount(const JSONRPCRequest& request)
|
||||
UniValue ping(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 0)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"ping\n"
|
||||
"\nRequests that a ping be sent to all other nodes, to measure ping time.\n"
|
||||
"Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds.\n"
|
||||
@@ -70,7 +68,7 @@ UniValue ping(const JSONRPCRequest& request)
|
||||
UniValue getpeerinfo(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 0)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"getpeerinfo\n"
|
||||
"\nReturns data about each connected network node as a json array of objects.\n"
|
||||
"\nResult:\n"
|
||||
@@ -102,7 +100,7 @@ UniValue getpeerinfo(const JSONRPCRequest& request)
|
||||
" n, (numeric) The heights of blocks we're currently asking from this peer\n"
|
||||
" ...\n"
|
||||
" ],\n"
|
||||
" \"whitelisted\": true|false, (boolean) Whether the peer is whitelisted\n"
|
||||
" \"whitelisted\": true|false, (boolean) Whether the peer is whitelisted\n"
|
||||
" \"bytessent_per_msg\": {\n"
|
||||
" \"addr\": n, (numeric) The total bytes sent aggregated by message type\n"
|
||||
" ...\n"
|
||||
@@ -122,7 +120,7 @@ UniValue getpeerinfo(const JSONRPCRequest& request)
|
||||
if(!g_connman)
|
||||
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
||||
|
||||
vector<CNodeStats> vstats;
|
||||
std::vector<CNodeStats> vstats;
|
||||
g_connman->GetNodeStats(vstats);
|
||||
|
||||
UniValue ret(UniValue::VARR);
|
||||
@@ -191,12 +189,12 @@ UniValue getpeerinfo(const JSONRPCRequest& request)
|
||||
|
||||
UniValue addnode(const JSONRPCRequest& request)
|
||||
{
|
||||
string strCommand;
|
||||
std::string strCommand;
|
||||
if (request.params.size() == 2)
|
||||
strCommand = request.params[1].get_str();
|
||||
if (request.fHelp || request.params.size() != 2 ||
|
||||
(strCommand != "onetry" && strCommand != "add" && strCommand != "remove"))
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"addnode \"node\" \"add|remove|onetry\"\n"
|
||||
"\nAttempts add or remove a node from the addnode list.\n"
|
||||
"Or try a connection to a node once.\n"
|
||||
@@ -211,7 +209,7 @@ UniValue addnode(const JSONRPCRequest& request)
|
||||
if(!g_connman)
|
||||
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
|
||||
|
||||
string strNode = request.params[0].get_str();
|
||||
std::string strNode = request.params[0].get_str();
|
||||
|
||||
if (strCommand == "onetry")
|
||||
{
|
||||
@@ -237,7 +235,7 @@ UniValue addnode(const JSONRPCRequest& request)
|
||||
UniValue disconnectnode(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"disconnectnode \"node\" \n"
|
||||
"\nImmediately disconnects from the specified node.\n"
|
||||
"\nArguments:\n"
|
||||
@@ -260,7 +258,7 @@ UniValue disconnectnode(const JSONRPCRequest& request)
|
||||
UniValue getaddednodeinfo(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() > 1)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"getaddednodeinfo ( \"node\" )\n"
|
||||
"\nReturns information about the given added node, or all added nodes\n"
|
||||
"(note that onetry addnodes are not listed here)\n"
|
||||
@@ -328,7 +326,7 @@ UniValue getaddednodeinfo(const JSONRPCRequest& request)
|
||||
UniValue getnettotals(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() > 0)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"getnettotals\n"
|
||||
"\nReturns information about network traffic, including bytes in, bytes out,\n"
|
||||
"and current time.\n"
|
||||
@@ -384,7 +382,7 @@ static UniValue GetNetworksInfo()
|
||||
obj.push_back(Pair("name", GetNetworkName(network)));
|
||||
obj.push_back(Pair("limited", IsLimited(network)));
|
||||
obj.push_back(Pair("reachable", IsReachable(network)));
|
||||
obj.push_back(Pair("proxy", proxy.IsValid() ? proxy.proxy.ToStringIPPort() : string()));
|
||||
obj.push_back(Pair("proxy", proxy.IsValid() ? proxy.proxy.ToStringIPPort() : std::string()));
|
||||
obj.push_back(Pair("proxy_randomize_credentials", proxy.randomize_credentials));
|
||||
networks.push_back(obj);
|
||||
}
|
||||
@@ -394,7 +392,7 @@ static UniValue GetNetworksInfo()
|
||||
UniValue getnetworkinfo(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 0)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"getnetworkinfo\n"
|
||||
"Returns an object containing various state info regarding P2P networking.\n"
|
||||
"\nResult:\n"
|
||||
@@ -469,12 +467,12 @@ UniValue getnetworkinfo(const JSONRPCRequest& request)
|
||||
|
||||
UniValue setban(const JSONRPCRequest& request)
|
||||
{
|
||||
string strCommand;
|
||||
std::string strCommand;
|
||||
if (request.params.size() >= 2)
|
||||
strCommand = request.params[1].get_str();
|
||||
if (request.fHelp || request.params.size() < 2 ||
|
||||
(strCommand != "add" && strCommand != "remove"))
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"setban \"subnet\" \"add|remove\" (bantime) (absolute)\n"
|
||||
"\nAttempts add or remove a IP/Subnet from the banned list.\n"
|
||||
"\nArguments:\n"
|
||||
@@ -494,7 +492,7 @@ UniValue setban(const JSONRPCRequest& request)
|
||||
CNetAddr netAddr;
|
||||
bool isSubnet = false;
|
||||
|
||||
if (request.params[0].get_str().find("/") != string::npos)
|
||||
if (request.params[0].get_str().find("/") != std::string::npos)
|
||||
isSubnet = true;
|
||||
|
||||
if (!isSubnet) {
|
||||
@@ -534,7 +532,7 @@ UniValue setban(const JSONRPCRequest& request)
|
||||
UniValue listbanned(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 0)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"listbanned\n"
|
||||
"\nList all banned IPs/Subnets.\n"
|
||||
"\nExamples:\n"
|
||||
@@ -567,7 +565,7 @@ UniValue listbanned(const JSONRPCRequest& request)
|
||||
UniValue clearbanned(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 0)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"clearbanned\n"
|
||||
"\nClear all banned IPs.\n"
|
||||
"\nExamples:\n"
|
||||
@@ -585,7 +583,7 @@ UniValue clearbanned(const JSONRPCRequest& request)
|
||||
UniValue setnetworkactive(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 1) {
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"setnetworkactive true|false\n"
|
||||
"\nDisable/enable all p2p network activity.\n"
|
||||
"\nArguments:\n"
|
||||
|
||||
Reference in New Issue
Block a user