mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Refactor: Remove using namespace <xxx> from rpc/
This commit is contained in:
@@ -30,8 +30,6 @@
|
||||
|
||||
#include <univalue.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* Return average network hashes per second based on the last 'lookup' blocks,
|
||||
* or from the last difficulty change if 'lookup' is nonpositive.
|
||||
@@ -77,7 +75,7 @@ UniValue GetNetworkHashPS(int lookup, int height) {
|
||||
UniValue getnetworkhashps(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() > 2)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"getnetworkhashps ( nblocks height )\n"
|
||||
"\nReturns the estimated network hashes per second based on the last n blocks.\n"
|
||||
"Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n"
|
||||
@@ -149,7 +147,7 @@ UniValue generateBlocks(boost::shared_ptr<CReserveScript> coinbaseScript, int nG
|
||||
UniValue generate(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"generate nblocks ( maxtries )\n"
|
||||
"\nMine up to nblocks blocks immediately (before the RPC call returns)\n"
|
||||
"\nArguments:\n"
|
||||
@@ -185,7 +183,7 @@ UniValue generate(const JSONRPCRequest& request)
|
||||
UniValue generatetoaddress(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"generatetoaddress nblocks address (maxtries)\n"
|
||||
"\nMine blocks immediately to a specified address (before the RPC call returns)\n"
|
||||
"\nArguments:\n"
|
||||
@@ -208,7 +206,7 @@ UniValue generatetoaddress(const JSONRPCRequest& request)
|
||||
CBitcoinAddress address(request.params[1].get_str());
|
||||
if (!address.IsValid())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Invalid address");
|
||||
|
||||
|
||||
boost::shared_ptr<CReserveScript> coinbaseScript(new CReserveScript());
|
||||
coinbaseScript->reserveScript = GetScriptForDestination(address.Get());
|
||||
|
||||
@@ -218,7 +216,7 @@ UniValue generatetoaddress(const JSONRPCRequest& request)
|
||||
UniValue getmininginfo(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 0)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"getmininginfo\n"
|
||||
"\nReturns a json object containing mining-related information."
|
||||
"\nResult:\n"
|
||||
@@ -259,7 +257,7 @@ UniValue getmininginfo(const JSONRPCRequest& request)
|
||||
UniValue prioritisetransaction(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 2)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"prioritisetransaction <txid> <fee delta>\n"
|
||||
"Accepts the transaction into mined blocks at a higher (or lower) priority\n"
|
||||
"\nArguments:\n"
|
||||
@@ -315,7 +313,7 @@ std::string gbt_vb_name(const Consensus::DeploymentPos pos) {
|
||||
UniValue getblocktemplate(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() > 1)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"getblocktemplate ( TemplateRequest )\n"
|
||||
"\nIf the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n"
|
||||
"It returns data needed to construct a block to work on.\n"
|
||||
@@ -553,7 +551,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
||||
UniValue aCaps(UniValue::VARR); aCaps.push_back("proposal");
|
||||
|
||||
UniValue transactions(UniValue::VARR);
|
||||
map<uint256, int64_t> setTxIndex;
|
||||
std::map<uint256, int64_t> setTxIndex;
|
||||
int i = 0;
|
||||
for (const auto& it : pblock->vtx) {
|
||||
const CTransaction& tx = *it;
|
||||
@@ -712,7 +710,7 @@ protected:
|
||||
UniValue submitblock(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"submitblock \"hexdata\" ( \"jsonparametersobject\" )\n"
|
||||
"\nAttempts to submit new block to network.\n"
|
||||
"The 'jsonparametersobject' parameter is currently ignored.\n"
|
||||
@@ -777,7 +775,7 @@ UniValue submitblock(const JSONRPCRequest& request)
|
||||
UniValue estimatefee(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"estimatefee nblocks\n"
|
||||
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
|
||||
"confirmation within nblocks blocks. Uses virtual transaction size of transaction\n"
|
||||
@@ -811,7 +809,7 @@ UniValue estimatefee(const JSONRPCRequest& request)
|
||||
UniValue estimatesmartfee(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw runtime_error(
|
||||
throw std::runtime_error(
|
||||
"estimatesmartfee nblocks\n"
|
||||
"\nWARNING: This interface is unstable and may disappear or change!\n"
|
||||
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
|
||||
|
||||
Reference in New Issue
Block a user