mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-13 14:13:52 +02:00
scripted-diff: rpc: Rename RPCHelpMan to RPCMethod
Since this class defines the functionality of the RPC method, not just its help text, this better reflects reality. -BEGIN VERIFY SCRIPT- sed -i -e 's/\bRPCHelpMan\b/RPCMethod/g' $(git grep -l RPCHelpMan src/) -END VERIFY SCRIPT-
This commit is contained in:
@@ -108,9 +108,9 @@ static UniValue GetNetworkHashPS(int lookup, int height, const CChain& active_ch
|
||||
return workDiff.getdouble() / timeDiff;
|
||||
}
|
||||
|
||||
static RPCHelpMan getnetworkhashps()
|
||||
static RPCMethod getnetworkhashps()
|
||||
{
|
||||
return RPCHelpMan{
|
||||
return RPCMethod{
|
||||
"getnetworkhashps",
|
||||
"Returns 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"
|
||||
@@ -125,7 +125,7 @@ static RPCHelpMan getnetworkhashps()
|
||||
HelpExampleCli("getnetworkhashps", "")
|
||||
+ HelpExampleRpc("getnetworkhashps", "")
|
||||
},
|
||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
|
||||
{
|
||||
ChainstateManager& chainman = EnsureAnyChainman(request.context);
|
||||
LOCK(cs_main);
|
||||
@@ -216,9 +216,9 @@ static bool getScriptFromDescriptor(std::string_view descriptor, CScript& script
|
||||
return true;
|
||||
}
|
||||
|
||||
static RPCHelpMan generatetodescriptor()
|
||||
static RPCMethod generatetodescriptor()
|
||||
{
|
||||
return RPCHelpMan{
|
||||
return RPCMethod{
|
||||
"generatetodescriptor",
|
||||
"Mine to a specified descriptor and return the block hashes.",
|
||||
{
|
||||
@@ -234,7 +234,7 @@ static RPCHelpMan generatetodescriptor()
|
||||
},
|
||||
RPCExamples{
|
||||
"\nGenerate 11 blocks to mydesc\n" + HelpExampleCli("generatetodescriptor", "11 \"mydesc\"")},
|
||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
|
||||
{
|
||||
const auto num_blocks{self.Arg<int>("num_blocks")};
|
||||
const auto max_tries{self.Arg<uint64_t>("maxtries")};
|
||||
@@ -254,16 +254,16 @@ static RPCHelpMan generatetodescriptor()
|
||||
};
|
||||
}
|
||||
|
||||
static RPCHelpMan generate()
|
||||
static RPCMethod generate()
|
||||
{
|
||||
return RPCHelpMan{"generate", "has been replaced by the -generate cli option. Refer to -help for more information.", {}, {}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue {
|
||||
return RPCMethod{"generate", "has been replaced by the -generate cli option. Refer to -help for more information.", {}, {}, RPCExamples{""}, [&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue {
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, self.ToString());
|
||||
}};
|
||||
}
|
||||
|
||||
static RPCHelpMan generatetoaddress()
|
||||
static RPCMethod generatetoaddress()
|
||||
{
|
||||
return RPCHelpMan{"generatetoaddress",
|
||||
return RPCMethod{"generatetoaddress",
|
||||
"Mine to a specified address and return the block hashes.",
|
||||
{
|
||||
{"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, "How many blocks are generated."},
|
||||
@@ -281,7 +281,7 @@ static RPCHelpMan generatetoaddress()
|
||||
+ "If you are using the " CLIENT_NAME " wallet, you can get a new address to send the newly generated bitcoin to with:\n"
|
||||
+ HelpExampleCli("getnewaddress", "")
|
||||
},
|
||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
|
||||
{
|
||||
const int num_blocks{request.params[0].getInt<int>()};
|
||||
const uint64_t max_tries{request.params[2].isNull() ? DEFAULT_MAX_TRIES : request.params[2].getInt<int>()};
|
||||
@@ -302,9 +302,9 @@ static RPCHelpMan generatetoaddress()
|
||||
};
|
||||
}
|
||||
|
||||
static RPCHelpMan generateblock()
|
||||
static RPCMethod generateblock()
|
||||
{
|
||||
return RPCHelpMan{"generateblock",
|
||||
return RPCMethod{"generateblock",
|
||||
"Mine a set of ordered transactions to a specified address or descriptor and return the block hash.\n"
|
||||
"Transaction fees are not collected in the block reward.",
|
||||
{
|
||||
@@ -329,7 +329,7 @@ static RPCHelpMan generateblock()
|
||||
"\nGenerate a block to myaddress, with txs rawtx and mempool_txid\n"
|
||||
+ HelpExampleCli("generateblock", R"("myaddress" '["rawtx", "mempool_txid"]')")
|
||||
},
|
||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
|
||||
{
|
||||
const auto address_or_descriptor = request.params[0].get_str();
|
||||
CScript coinbase_output_script;
|
||||
@@ -413,9 +413,9 @@ static RPCHelpMan generateblock()
|
||||
};
|
||||
}
|
||||
|
||||
static RPCHelpMan getmininginfo()
|
||||
static RPCMethod getmininginfo()
|
||||
{
|
||||
return RPCHelpMan{
|
||||
return RPCMethod{
|
||||
"getmininginfo",
|
||||
"Returns a json object containing mining-related information.",
|
||||
{},
|
||||
@@ -453,7 +453,7 @@ static RPCHelpMan getmininginfo()
|
||||
HelpExampleCli("getmininginfo", "")
|
||||
+ HelpExampleRpc("getmininginfo", "")
|
||||
},
|
||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
|
||||
{
|
||||
NodeContext& node = EnsureAnyNodeContext(request.context);
|
||||
const CTxMemPool& mempool = EnsureMemPool(node);
|
||||
@@ -499,9 +499,9 @@ static RPCHelpMan getmininginfo()
|
||||
|
||||
|
||||
// NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts
|
||||
static RPCHelpMan prioritisetransaction()
|
||||
static RPCMethod prioritisetransaction()
|
||||
{
|
||||
return RPCHelpMan{"prioritisetransaction",
|
||||
return RPCMethod{"prioritisetransaction",
|
||||
"Accepts the transaction into mined blocks at a higher (or lower) priority\n",
|
||||
{
|
||||
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id."},
|
||||
@@ -518,7 +518,7 @@ static RPCHelpMan prioritisetransaction()
|
||||
HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000")
|
||||
+ HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")
|
||||
},
|
||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
|
||||
{
|
||||
LOCK(cs_main);
|
||||
|
||||
@@ -544,9 +544,9 @@ static RPCHelpMan prioritisetransaction()
|
||||
};
|
||||
}
|
||||
|
||||
static RPCHelpMan getprioritisedtransactions()
|
||||
static RPCMethod getprioritisedtransactions()
|
||||
{
|
||||
return RPCHelpMan{"getprioritisedtransactions",
|
||||
return RPCMethod{"getprioritisedtransactions",
|
||||
"Returns a map of all user-created (see prioritisetransaction) fee deltas by txid, and whether the tx is present in mempool.",
|
||||
{},
|
||||
RPCResult{
|
||||
@@ -563,7 +563,7 @@ static RPCHelpMan getprioritisedtransactions()
|
||||
HelpExampleCli("getprioritisedtransactions", "")
|
||||
+ HelpExampleRpc("getprioritisedtransactions", "")
|
||||
},
|
||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
|
||||
{
|
||||
NodeContext& node = EnsureAnyNodeContext(request.context);
|
||||
CTxMemPool& mempool = EnsureMemPool(node);
|
||||
@@ -612,9 +612,9 @@ static std::string gbt_rule_value(const std::string& name, bool gbt_optional_rul
|
||||
return s;
|
||||
}
|
||||
|
||||
static RPCHelpMan getblocktemplate()
|
||||
static RPCMethod getblocktemplate()
|
||||
{
|
||||
return RPCHelpMan{
|
||||
return RPCMethod{
|
||||
"getblocktemplate",
|
||||
"If 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"
|
||||
@@ -704,7 +704,7 @@ static RPCHelpMan getblocktemplate()
|
||||
HelpExampleCli("getblocktemplate", "'{\"rules\": [\"segwit\"]}'")
|
||||
+ HelpExampleRpc("getblocktemplate", "{\"rules\": [\"segwit\"]}")
|
||||
},
|
||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
|
||||
{
|
||||
NodeContext& node = EnsureAnyNodeContext(request.context);
|
||||
ChainstateManager& chainman = EnsureChainman(node);
|
||||
@@ -1053,10 +1053,10 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
static RPCHelpMan submitblock()
|
||||
static RPCMethod submitblock()
|
||||
{
|
||||
// We allow 2 arguments for compliance with BIP22. Argument 2 is ignored.
|
||||
return RPCHelpMan{
|
||||
return RPCMethod{
|
||||
"submitblock",
|
||||
"Attempts to submit new block to network.\n"
|
||||
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n",
|
||||
@@ -1072,7 +1072,7 @@ static RPCHelpMan submitblock()
|
||||
HelpExampleCli("submitblock", "\"mydata\"")
|
||||
+ HelpExampleRpc("submitblock", "\"mydata\"")
|
||||
},
|
||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
|
||||
{
|
||||
std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
|
||||
CBlock& block = *blockptr;
|
||||
@@ -1105,9 +1105,9 @@ static RPCHelpMan submitblock()
|
||||
};
|
||||
}
|
||||
|
||||
static RPCHelpMan submitheader()
|
||||
static RPCMethod submitheader()
|
||||
{
|
||||
return RPCHelpMan{
|
||||
return RPCMethod{
|
||||
"submitheader",
|
||||
"Decode the given hexdata as a header and submit it as a candidate chain tip if valid."
|
||||
"\nThrows when the header is invalid.\n",
|
||||
@@ -1120,7 +1120,7 @@ static RPCHelpMan submitheader()
|
||||
HelpExampleCli("submitheader", "\"aabbcc\"") +
|
||||
HelpExampleRpc("submitheader", "\"aabbcc\"")
|
||||
},
|
||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||
[&](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
|
||||
{
|
||||
CBlockHeader h;
|
||||
if (!DecodeHexBlockHeader(h, request.params[0].get_str())) {
|
||||
|
||||
Reference in New Issue
Block a user