mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Merge 357488f660 into merged_master (Bitcoin PR #16240)
This commit is contained in:
commit
f11c2f3dab
19 changed files with 258 additions and 583 deletions
|
|
@ -85,8 +85,6 @@ static UniValue GetNetworkHashPS(int lookup, int height) {
|
|||
|
||||
static UniValue getnetworkhashps(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getnetworkhashps",
|
||||
"\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"
|
||||
|
|
@ -102,7 +100,7 @@ static UniValue getnetworkhashps(const JSONRPCRequest& request)
|
|||
HelpExampleCli("getnetworkhashps", "")
|
||||
+ HelpExampleRpc("getnetworkhashps", "")
|
||||
},
|
||||
}.ToString());
|
||||
}.Check(request);
|
||||
|
||||
LOCK(cs_main);
|
||||
return GetNetworkHashPS(!request.params[0].isNull() ? request.params[0].get_int() : 120, !request.params[1].isNull() ? request.params[1].get_int() : -1);
|
||||
|
|
@ -155,8 +153,6 @@ static UniValue generateBlocks(const CScript& coinbase_script, int nGenerate, ui
|
|||
|
||||
static UniValue generatetoaddress(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"generatetoaddress",
|
||||
"\nMine blocks immediately to a specified address (before the RPC call returns)\n",
|
||||
{
|
||||
|
|
@ -173,7 +169,7 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
|
|||
+ "If you are running the bitcoin core wallet, you can get a new address to send the newly generated bitcoin to with:\n"
|
||||
+ HelpExampleCli("getnewaddress", "")
|
||||
},
|
||||
}.ToString());
|
||||
}.Check(request);
|
||||
|
||||
int nGenerate = request.params[0].get_int();
|
||||
uint64_t nMaxTries = 1000000;
|
||||
|
|
@ -193,8 +189,6 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
|
|||
|
||||
static UniValue getmininginfo(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 0) {
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getmininginfo",
|
||||
"\nReturns a json object containing mining-related information.",
|
||||
{},
|
||||
|
|
@ -214,8 +208,7 @@ static UniValue getmininginfo(const JSONRPCRequest& request)
|
|||
HelpExampleCli("getmininginfo", "")
|
||||
+ HelpExampleRpc("getmininginfo", "")
|
||||
},
|
||||
}.ToString());
|
||||
}
|
||||
}.Check(request);
|
||||
|
||||
LOCK(cs_main);
|
||||
|
||||
|
|
@ -237,8 +230,6 @@ static UniValue getmininginfo(const JSONRPCRequest& request)
|
|||
// NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts
|
||||
static UniValue prioritisetransaction(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 3)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"prioritisetransaction",
|
||||
"Accepts the transaction into mined blocks at a higher (or lower) priority\n",
|
||||
{
|
||||
|
|
@ -257,7 +248,7 @@ static UniValue prioritisetransaction(const JSONRPCRequest& request)
|
|||
HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000")
|
||||
+ HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")
|
||||
},
|
||||
}.ToString());
|
||||
}.Check(request);
|
||||
|
||||
LOCK(cs_main);
|
||||
|
||||
|
|
@ -303,8 +294,6 @@ static std::string gbt_vb_name(const Consensus::DeploymentPos pos) {
|
|||
|
||||
static UniValue getblocktemplate(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() > 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getblocktemplate",
|
||||
"\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"
|
||||
|
|
@ -314,7 +303,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||
" https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n"
|
||||
" https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n",
|
||||
{
|
||||
{"template_request", RPCArg::Type::OBJ, RPCArg::Optional::NO, "A json object in the following spec",
|
||||
{"template_request", RPCArg::Type::OBJ, "{}", "A json object in the following spec",
|
||||
{
|
||||
{"mode", RPCArg::Type::STR, /* treat as named arg */ RPCArg::Optional::OMITTED_NAMED_ARG, "This must be set to \"template\", \"proposal\" (see BIP 23), or omitted"},
|
||||
{"capabilities", RPCArg::Type::ARR, /* treat as named arg */ RPCArg::Optional::OMITTED_NAMED_ARG, "A list of strings",
|
||||
|
|
@ -379,7 +368,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||
HelpExampleCli("getblocktemplate", "{\"rules\": [\"segwit\"]}")
|
||||
+ HelpExampleRpc("getblocktemplate", "{\"rules\": [\"segwit\"]}")
|
||||
},
|
||||
}.ToString());
|
||||
}.Check(request);
|
||||
|
||||
LOCK(cs_main);
|
||||
|
||||
|
|
@ -709,8 +698,6 @@ protected:
|
|||
static UniValue submitblock(const JSONRPCRequest& request)
|
||||
{
|
||||
// We allow 2 arguments for compliance with BIP22. Argument 2 is ignored.
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"submitblock",
|
||||
"\nAttempts to submit new block to network.\n"
|
||||
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n",
|
||||
|
|
@ -723,8 +710,7 @@ static UniValue submitblock(const JSONRPCRequest& request)
|
|||
HelpExampleCli("submitblock", "\"mydata\"")
|
||||
+ HelpExampleRpc("submitblock", "\"mydata\"")
|
||||
},
|
||||
}.ToString());
|
||||
}
|
||||
}.Check(request);
|
||||
|
||||
std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
|
||||
CBlock& block = *blockptr;
|
||||
|
|
@ -774,8 +760,6 @@ static UniValue submitblock(const JSONRPCRequest& request)
|
|||
|
||||
static UniValue submitheader(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 1) {
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"submitheader",
|
||||
"\nDecode the given hexdata as a header and submit it as a candidate chain tip if valid."
|
||||
"\nThrows when the header is invalid.\n",
|
||||
|
|
@ -789,8 +773,7 @@ static UniValue submitheader(const JSONRPCRequest& request)
|
|||
HelpExampleCli("submitheader", "\"aabbcc\"") +
|
||||
HelpExampleRpc("submitheader", "\"aabbcc\"")
|
||||
},
|
||||
}.ToString());
|
||||
}
|
||||
}.Check(request);
|
||||
|
||||
CBlockHeader h;
|
||||
if (!DecodeHexBlockHeader(h, request.params[0].get_str())) {
|
||||
|
|
@ -814,8 +797,6 @@ static UniValue submitheader(const JSONRPCRequest& request)
|
|||
|
||||
static UniValue estimatesmartfee(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"estimatesmartfee",
|
||||
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
|
||||
"confirmation within conf_target blocks if possible and return the number of blocks\n"
|
||||
|
|
@ -848,7 +829,7 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
|
|||
RPCExamples{
|
||||
HelpExampleCli("estimatesmartfee", "6")
|
||||
},
|
||||
}.ToString());
|
||||
}.Check(request);
|
||||
|
||||
RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VSTR});
|
||||
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
|
||||
|
|
@ -879,8 +860,6 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
|
|||
|
||||
static UniValue estimaterawfee(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"estimaterawfee",
|
||||
"\nWARNING: This interface is unstable and may disappear or change!\n"
|
||||
"\nWARNING: This is an advanced API call that is tightly coupled to the specific\n"
|
||||
|
|
@ -921,7 +900,7 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
|
|||
RPCExamples{
|
||||
HelpExampleCli("estimaterawfee", "6 0.9")
|
||||
},
|
||||
}.ToString());
|
||||
}.Check(request);
|
||||
|
||||
RPCTypeCheck(request.params, {UniValue::VNUM, UniValue::VNUM}, true);
|
||||
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue