Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 2) { | ||||
{"nblocks", RPCArg::Type::NUM, /* opt */ true, | {"nblocks", RPCArg::Type::NUM, /* opt */ true, | ||||
/* default_val */ "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, /* opt */ true, | ||||
/* default_val */ "-1", | /* default_val */ "-1", | ||||
"To estimate at the time of the given height."}, | "To estimate at the time of the given height."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"x (numeric) Hashes per second estimated\n" | "x (numeric) Hashes per second estimated\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("getnetworkhashps", "") + | HelpExampleCli("getnetworkhashps", "") + | ||||
HelpExampleRpc("getnetworkhashps", "")); | HelpExampleRpc("getnetworkhashps", "")); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
"How many blocks are generated immediately."}, | "How many blocks are generated immediately."}, | ||||
{"address", RPCArg::Type::STR, /* opt */ false, | {"address", RPCArg::Type::STR, /* opt */ false, | ||||
/* default_val */ "", | /* 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, /* opt */ true, | ||||
/* default_val */ "1000000", | /* default_val */ "1000000", | ||||
"How many iterations to try."}, | "How many iterations to try."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"[ blockhashes ] (array) hashes of blocks generated\n" | "[ blockhashes ] (array) hashes of blocks generated\n" | ||||
"\nExamples:\n" | "\nExamples:\n" | ||||
"\nGenerate 11 blocks to myaddress\n" + | "\nGenerate 11 blocks to myaddress\n" + | ||||
HelpExampleCli("generatetoaddress", "11 \"myaddress\"")); | HelpExampleCli("generatetoaddress", "11 \"myaddress\"")); | ||||
} | } | ||||
int nGenerate = request.params[0].get_int(); | int nGenerate = request.params[0].get_int(); | ||||
Show All 19 Lines | |||||
static UniValue getmininginfo(const Config &config, | static UniValue getmininginfo(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 0) { | if (request.fHelp || request.params.size() != 0) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{"getmininginfo", | RPCHelpMan{"getmininginfo", | ||||
"\nReturns a json object containing mining-related " | "\nReturns a json object containing mining-related " | ||||
"information.", | "information.", | ||||
{}} | {}} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"blocks\": nnn, (numeric) The current block\n" | " \"blocks\": nnn, (numeric) The current block\n" | ||||
" \"currentblocksize\": nnn, (numeric) The last block size\n" | " \"currentblocksize\": nnn, (numeric) The last block size\n" | ||||
" \"currentblocktx\": nnn, (numeric) The last block " | " \"currentblocktx\": nnn, (numeric) The last block " | ||||
"transaction\n" | "transaction\n" | ||||
" \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n" | " \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n" | ||||
" \"networkhashps\": nnn, (numeric) The network hashes per " | " \"networkhashps\": nnn, (numeric) The network hashes per " | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 3) { | ||||
"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."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"true (boolean) Returns true\n" | "true (boolean) Returns true\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000") + | HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000") + | ||||
HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")); | HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 1) { | ||||
"client side supported feature, 'longpoll', " | "client side supported feature, 'longpoll', " | ||||
"'coinbasetxn', 'coinbasevalue', 'proposal', " | "'coinbasetxn', 'coinbasevalue', 'proposal', " | ||||
"'serverlist', 'workid'"}, | "'serverlist', 'workid'"}, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
"\"template_request\""}, | "\"template_request\""}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"version\" : n, (numeric) The preferred " | " \"version\" : n, (numeric) The preferred " | ||||
"block version\n" | "block version\n" | ||||
" \"previousblockhash\" : \"xxxx\", (string) The hash of " | " \"previousblockhash\" : \"xxxx\", (string) The hash of " | ||||
"current highest block\n" | "current highest block\n" | ||||
" \"transactions\" : [ (array) contents of " | " \"transactions\" : [ (array) contents of " | ||||
"non-coinbase transactions that should be included in the next " | "non-coinbase transactions that should be included in the next " | ||||
▲ Show 20 Lines • Show All 328 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
{"hexdata", RPCArg::Type::STR_HEX, /* opt */ false, | {"hexdata", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", | /* 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, /* opt */ true, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"dummy value, for compatibility with BIP22. This " | "dummy value, for compatibility with BIP22. This " | ||||
"value is ignored."}, | "value is ignored."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("submitblock", "\"mydata\"") + | HelpExampleCli("submitblock", "\"mydata\"") + | ||||
HelpExampleRpc("submitblock", "\"mydata\"")); | HelpExampleRpc("submitblock", "\"mydata\"")); | ||||
} | } | ||||
std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>(); | std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>(); | ||||
CBlock &block = *blockptr; | CBlock &block = *blockptr; | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"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, /* opt */ false, | ||||
/* default_val */ "", "the hex-encoded block header data"}, | /* default_val */ "", "the hex-encoded block header data"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"None" | "None" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("submitheader", "\"aabbcc\"") + | HelpExampleCli("submitheader", "\"aabbcc\"") + | ||||
HelpExampleRpc("submitheader", "\"aabbcc\"")); | HelpExampleRpc("submitheader", "\"aabbcc\"")); | ||||
} | } | ||||
CBlockHeader h; | CBlockHeader h; | ||||
Show All 25 Lines | |||||
static UniValue estimatefee(const Config &config, | static UniValue estimatefee(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() > 0) { | if (request.fHelp || request.params.size() > 0) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{"estimatefee", | RPCHelpMan{"estimatefee", | ||||
"\nEstimates the approximate fee per kilobyte needed " | "\nEstimates the approximate fee per kilobyte needed " | ||||
"for a transaction\n", | "for a transaction\n", | ||||
{}} | {}} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"n (numeric) estimated fee-per-kilobyte\n" | "n (numeric) estimated fee-per-kilobyte\n" | ||||
"\nExample:\n" + | "\nExample:\n" + | ||||
HelpExampleCli("estimatefee", "")); | HelpExampleCli("estimatefee", "")); | ||||
} | } | ||||
return ValueFromAmount(g_mempool.estimateFee().GetFeePerK()); | return ValueFromAmount(g_mempool.estimateFee().GetFeePerK()); | ||||
} | } | ||||
Show All 23 Lines |