Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 689 Lines • ▼ Show 20 Lines | void BlockChecked(const CBlock &block, | ||||
found = true; | found = true; | ||||
state = stateIn; | state = stateIn; | ||||
} | } | ||||
}; | }; | ||||
static UniValue submitblock(const Config &config, | static UniValue submitblock(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
// We allow 2 arguments for compliance with BIP22. Argument 2 is ignored. | |||||
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( | throw std::runtime_error( | ||||
"submitblock \"hexdata\" ( \"jsonparametersobject\" )\n" | "submitblock \"hexdata\" ( \"dummy\" )\n" | ||||
"\nAttempts to submit new block to network.\n" | "\nAttempts to submit new block to network.\n" | ||||
"The 'jsonparametersobject' parameter is currently ignored.\n" | |||||
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n" | "See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n" | ||||
"\nArguments\n" | "\nArguments\n" | ||||
"1. \"hexdata\" (string, required) the hex-encoded block " | "1. \"hexdata\" (string, required) the hex-encoded block " | ||||
"data to submit\n" | "data to submit\n" | ||||
"2. \"parameters\" (string, optional) object of optional " | "2. \"dummy\" (optional) dummy value, for compatibility " | ||||
"parameters\n" | "with BIP22. This value is ignored.\n" | ||||
" {\n" | |||||
" \"workid\" : \"id\" (string, optional) if the server " | |||||
"provided a workid, it MUST be included with submissions\n" | |||||
" }\n" | |||||
"\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 72 Lines • ▼ Show 20 Lines | |||||
// clang-format off | // clang-format off | ||||
static const ContextFreeRPCCommand commands[] = { | static const ContextFreeRPCCommand commands[] = { | ||||
// category name actor (function) argNames | // category name actor (function) argNames | ||||
// ---------- ------------------------ ---------------------- ---------- | // ---------- ------------------------ ---------------------- ---------- | ||||
{"mining", "getnetworkhashps", getnetworkhashps, {"nblocks", "height"}}, | {"mining", "getnetworkhashps", getnetworkhashps, {"nblocks", "height"}}, | ||||
{"mining", "getmininginfo", getmininginfo, {}}, | {"mining", "getmininginfo", getmininginfo, {}}, | ||||
{"mining", "prioritisetransaction", prioritisetransaction, {"txid", "priority_delta", "fee_delta"}}, | {"mining", "prioritisetransaction", prioritisetransaction, {"txid", "priority_delta", "fee_delta"}}, | ||||
{"mining", "getblocktemplate", getblocktemplate, {"template_request"}}, | {"mining", "getblocktemplate", getblocktemplate, {"template_request"}}, | ||||
{"mining", "submitblock", submitblock, {"hexdata", "parameters"}}, | {"mining", "submitblock", submitblock, {"hexdata", "dummy"}}, | ||||
{"generating", "generatetoaddress", generatetoaddress, {"nblocks", "address", "maxtries"}}, | {"generating", "generatetoaddress", generatetoaddress, {"nblocks", "address", "maxtries"}}, | ||||
{"util", "estimatefee", estimatefee, {"nblocks"}}, | {"util", "estimatefee", estimatefee, {"nblocks"}}, | ||||
}; | }; | ||||
// clang-format on | // clang-format on | ||||
void RegisterMiningRPCCommands(CRPCTable &t) { | void RegisterMiningRPCCommands(CRPCTable &t) { | ||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) | for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) | ||||
t.appendCommand(commands[vcidx].name, &commands[vcidx]); | t.appendCommand(commands[vcidx].name, &commands[vcidx]); | ||||
} | } |