Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 275 Lines • ▼ Show 20 Lines | static UniValue generatetodescriptor(const Config &config, | ||||
const CTxMemPool &mempool = EnsureMemPool(request.context); | const CTxMemPool &mempool = EnsureMemPool(request.context); | ||||
ChainstateManager &chainman = EnsureChainman(request.context); | ChainstateManager &chainman = EnsureChainman(request.context); | ||||
return generateBlocks(config, chainman, mempool, coinbase_script, | return generateBlocks(config, chainman, mempool, coinbase_script, | ||||
num_blocks, max_tries); | num_blocks, max_tries); | ||||
} | } | ||||
static UniValue generate(const Config &config, const JSONRPCRequest &request) { | |||||
const std::string help_str{ | |||||
"generate ( nblocks maxtries ) has been replaced by the -generate cli " | |||||
"option. Refer to -help for more information."}; | |||||
if (request.fHelp) { | |||||
throw std::runtime_error(help_str); | |||||
} else { | |||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, help_str); | |||||
} | |||||
} | |||||
static UniValue generatetoaddress(const Config &config, | static UniValue generatetoaddress(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"generatetoaddress", | "generatetoaddress", | ||||
"Mine blocks immediately to a specified address before the " | "Mine blocks immediately to a specified address before the " | ||||
"RPC call returns)\n", | "RPC call returns)\n", | ||||
{ | { | ||||
{"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, | {"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
▲ Show 20 Lines • Show All 868 Lines • ▼ Show 20 Lines | static const CRPCCommand commands[] = { | ||||
{"mining", "submitblock", submitblock, {"hexdata", "dummy"}}, | {"mining", "submitblock", submitblock, {"hexdata", "dummy"}}, | ||||
{"mining", "submitheader", submitheader, {"hexdata"}}, | {"mining", "submitheader", submitheader, {"hexdata"}}, | ||||
{"generating", "generatetoaddress", generatetoaddress, {"nblocks", "address", "maxtries"}}, | {"generating", "generatetoaddress", generatetoaddress, {"nblocks", "address", "maxtries"}}, | ||||
{"generating", "generatetodescriptor", generatetodescriptor, {"num_blocks","descriptor","maxtries"}}, | {"generating", "generatetodescriptor", generatetodescriptor, {"num_blocks","descriptor","maxtries"}}, | ||||
{"generating", "generateblock", generateblock, {"output","transactions"}}, | {"generating", "generateblock", generateblock, {"output","transactions"}}, | ||||
{"util", "estimatefee", estimatefee, {}}, | {"util", "estimatefee", estimatefee, {}}, | ||||
{"hidden", "generate", generate, {}}, | |||||
}; | }; | ||||
// clang-format on | // clang-format on | ||||
for (const auto &c : commands) { | for (const auto &c : commands) { | ||||
t.appendCommand(c.name, &c); | t.appendCommand(c.name, &c); | ||||
} | } | ||||
} | } |