Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 2) { | ||||
"getnetworkhashps", | "getnetworkhashps", | ||||
"\nReturns the estimated network hashes per second " | "\nReturns the estimated network hashes per second " | ||||
"based on the last n blocks.\n" | "based on the last n blocks.\n" | ||||
"Pass in [blocks] to override # of blocks, -1 specifies " | "Pass in [blocks] to override # of blocks, -1 specifies " | ||||
"since last difficulty change.\n" | "since last difficulty change.\n" | ||||
"Pass in [height] to estimate the network speed at the " | "Pass in [height] to estimate the network speed at the " | ||||
"time when a certain block was found.\n", | "time when a certain block was found.\n", | ||||
{ | { | ||||
{"nblocks", RPCArg::Type::NUM, /* opt */ true, | {"nblocks", RPCArg::Type::NUM, /* default */ "120", | ||||
/* default_val */ "120", | |||||
"The number of blocks, or -1 for blocks since last " | "The number of blocks, or -1 for blocks since last " | ||||
"difficulty change."}, | "difficulty change."}, | ||||
{"height", RPCArg::Type::NUM, /* opt */ true, | {"height", RPCArg::Type::NUM, /* default */ "-1", | ||||
/* default_val */ "-1", | |||||
"To estimate at the time of the given height."}, | "To estimate at the time of the given height."}, | ||||
}, | }, | ||||
RPCResult{"x (numeric) Hashes per second estimated\n"}, | RPCResult{"x (numeric) Hashes per second estimated\n"}, | ||||
RPCExamples{HelpExampleCli("getnetworkhashps", "") + | RPCExamples{HelpExampleCli("getnetworkhashps", "") + | ||||
HelpExampleRpc("getnetworkhashps", "")}, | HelpExampleRpc("getnetworkhashps", "")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | static UniValue generatetoaddress(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 2 || | if (request.fHelp || request.params.size() < 2 || | ||||
request.params.size() > 3) { | request.params.size() > 3) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"generatetoaddress", | "generatetoaddress", | ||||
"\nMine blocks immediately to a specified address before the " | "\nMine blocks immediately to a specified address before the " | ||||
"RPC call returns)\n", | "RPC call returns)\n", | ||||
{ | { | ||||
{"nblocks", RPCArg::Type::NUM, /* opt */ false, | {"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"How many blocks are generated immediately."}, | "How many blocks are generated immediately."}, | ||||
{"address", RPCArg::Type::STR, /* opt */ false, | {"address", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The address to send the newly generated bitcoin to."}, | "The address to send the newly generated bitcoin to."}, | ||||
{"maxtries", RPCArg::Type::NUM, /* opt */ true, | {"maxtries", RPCArg::Type::NUM, /* default */ "1000000", | ||||
/* default_val */ "1000000", "How many iterations to try."}, | "How many iterations to try."}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"[ blockhashes ] (array) hashes of blocks generated\n"}, | "[ blockhashes ] (array) hashes of blocks generated\n"}, | ||||
RPCExamples{ | RPCExamples{ | ||||
"\nGenerate 11 blocks to myaddress\n" + | "\nGenerate 11 blocks to myaddress\n" + | ||||
HelpExampleCli("generatetoaddress", "11 \"myaddress\"") + | HelpExampleCli("generatetoaddress", "11 \"myaddress\"") + | ||||
"If you are running the bitcoin core wallet, you can get a new " | "If you are running the bitcoin core wallet, you can get a new " | ||||
"address to send the newly generated bitcoin to with:\n" + | "address to send the newly generated bitcoin to with:\n" + | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
static UniValue prioritisetransaction(const Config &config, | static UniValue prioritisetransaction(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 3) { | if (request.fHelp || request.params.size() != 3) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"prioritisetransaction", | "prioritisetransaction", | ||||
"Accepts the transaction into mined blocks at a higher " | "Accepts the transaction into mined blocks at a higher " | ||||
"(or lower) priority\n", | "(or lower) priority\n", | ||||
{ | { | ||||
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, | {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The transaction id."}, | "The transaction id."}, | ||||
{"dummy", RPCArg::Type::NUM, /* opt */ true, | {"dummy", RPCArg::Type::NUM, | ||||
/* default_val */ "null", | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"API-Compatibility for previous API. Must be zero or " | "API-Compatibility for previous API. Must be zero or " | ||||
"null.\n" | "null.\n" | ||||
" DEPRECATED. For forward compatibility " | " DEPRECATED. For forward compatibility " | ||||
"use named arguments and omit this parameter."}, | "use named arguments and omit this parameter."}, | ||||
{"fee_delta", RPCArg::Type::NUM, /* opt */ false, | {"fee_delta", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The fee value (in satoshis) to add (or subtract, if " | "The fee value (in satoshis) to add (or subtract, if " | ||||
"negative).\n" | "negative).\n" | ||||
" The fee is not actually paid, " | " The fee is not actually paid, " | ||||
"only the algorithm for selecting transactions into a " | "only the algorithm for selecting transactions into a " | ||||
"block\n" | "block\n" | ||||
" considers the transaction as it would " | " considers the transaction as it would " | ||||
"have paid a higher (or lower) fee."}, | "have paid a higher (or lower) fee."}, | ||||
}, | }, | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 1) { | ||||
"bip-0023.mediawiki\n" | "bip-0023.mediawiki\n" | ||||
" " | " " | ||||
"https://github.com/bitcoin/bips/blob/master/" | "https://github.com/bitcoin/bips/blob/master/" | ||||
"bip-0009.mediawiki#getblocktemplate_changes\n" | "bip-0009.mediawiki#getblocktemplate_changes\n" | ||||
" ", | " ", | ||||
{ | { | ||||
{"template_request", | {"template_request", | ||||
RPCArg::Type::OBJ, | RPCArg::Type::OBJ, | ||||
/* opt */ true, | "{}", | ||||
Fabien: RPCArg::Optional::NO | |||||
deadalnixAuthorUnsubmitted Done Inline ActionsThis is erroneous and fixed in PR16240 https://github.com/bitcoin/bitcoin/pull/16240/commits/0ab8ba1ac65b70f044a5e323b13d098cef33695a deadalnix: This is erroneous and fixed in PR16240
https://github. | |||||
/* default_val */ "", | |||||
"A json object in the following spec", | "A json object in the following spec", | ||||
{ | { | ||||
{"mode", RPCArg::Type::STR, /* opt */ true, | {"mode", RPCArg::Type::STR, /* treat as named arg */ | ||||
/* default_val */ "", | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"This must be set to \"template\", \"proposal\" (see " | "This must be set to \"template\", \"proposal\" (see " | ||||
"BIP 23), or omitted"}, | "BIP 23), or omitted"}, | ||||
{ | { | ||||
"capabilities", | "capabilities", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ true, | /* treat as named arg */ | ||||
/* default_val */ "", | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"A list of strings", | "A list of strings", | ||||
{ | { | ||||
{"support", RPCArg::Type::STR, /* opt */ true, | {"support", RPCArg::Type::STR, | ||||
/* default_val */ "", | RPCArg::Optional::OMITTED, | ||||
"client side supported feature, 'longpoll', " | "client side supported feature, 'longpoll', " | ||||
"'coinbasetxn', 'coinbasevalue', 'proposal', " | "'coinbasetxn', 'coinbasevalue', 'proposal', " | ||||
"'serverlist', 'workid'"}, | "'serverlist', 'workid'"}, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
"\"template_request\""}, | "\"template_request\""}, | ||||
}, | }, | ||||
▲ Show 20 Lines • Show All 331 Lines • ▼ Show 20 Lines | static UniValue submitblock(const Config &config, | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"submitblock", | "submitblock", | ||||
"\nAttempts to submit new block to network.\n" | "\nAttempts to submit new block to network.\n" | ||||
"See https://en.bitcoin.it/wiki/BIP_0022 for full " | "See https://en.bitcoin.it/wiki/BIP_0022 for full " | ||||
"specification.\n", | "specification.\n", | ||||
{ | { | ||||
{"hexdata", RPCArg::Type::STR_HEX, /* opt */ false, | {"hexdata", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
/* default_val */ "", "the hex-encoded block data to submit"}, | "the hex-encoded block data to submit"}, | ||||
{"dummy", RPCArg::Type::STR, /* opt */ true, | {"dummy", RPCArg::Type::STR, /* default */ "ignored", | ||||
/* default_val */ "ignored", | |||||
"dummy value, for compatibility with BIP22. This value is " | "dummy value, for compatibility with BIP22. This value is " | ||||
"ignored."}, | "ignored."}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{HelpExampleCli("submitblock", "\"mydata\"") + | RPCExamples{HelpExampleCli("submitblock", "\"mydata\"") + | ||||
HelpExampleRpc("submitblock", "\"mydata\"")}, | HelpExampleRpc("submitblock", "\"mydata\"")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | static UniValue submitheader(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"submitheader", | "submitheader", | ||||
"\nDecode the given hexdata as a header and submit it as a " | "\nDecode the given hexdata as a header and submit it as a " | ||||
"candidate chain tip if valid." | "candidate chain tip if valid." | ||||
"\nThrows when the header is invalid.\n", | "\nThrows when the header is invalid.\n", | ||||
{ | { | ||||
{"hexdata", RPCArg::Type::STR_HEX, /* opt */ false, | {"hexdata", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
/* default_val */ "", "the hex-encoded block header data"}, | "the hex-encoded block header data"}, | ||||
}, | }, | ||||
RPCResult{"None"}, | RPCResult{"None"}, | ||||
RPCExamples{HelpExampleCli("submitheader", "\"aabbcc\"") + | RPCExamples{HelpExampleCli("submitheader", "\"aabbcc\"") + | ||||
HelpExampleRpc("submitheader", "\"aabbcc\"")}, | HelpExampleRpc("submitheader", "\"aabbcc\"")}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |
RPCArg::Optional::NO