Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | static UniValue getmininginfo(const Config &config, | ||||
return obj; | return obj; | ||||
} | } | ||||
// NOTE: Unlike wallet RPC (which use BCH values), mining RPCs follow GBT (BIP | // NOTE: Unlike wallet RPC (which use BCH values), mining RPCs follow GBT (BIP | ||||
// 22) in using satoshi amounts | // 22) in using satoshi amounts | ||||
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() != 2) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"prioritisetransaction <txid> <dummy> <fee delta>\n" | "prioritisetransaction <txid> <fee delta>\n" | ||||
"Accepts the transaction into mined blocks at a higher (or lower) " | "Accepts the transaction into mined blocks at a higher (or lower) " | ||||
"priority\n" | "priority\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"txid\" (string, required) The transaction id.\n" | "1. \"txid\" (string, required) The transaction id.\n" | ||||
"2. dummy (required) unused.\n" | "2. fee_delta (numeric, required) The fee value (in satoshis) " | ||||
"3. fee_delta (numeric, required) The fee value (in satoshis) " | |||||
"to add (or subtract, if negative).\n" | "to add (or subtract, if negative).\n" | ||||
" The fee is not actually paid, only the " | " The fee is not actually paid, only the " | ||||
"algorithm for selecting transactions into a block\n" | "algorithm for selecting transactions into a block\n" | ||||
" considers the transaction as it would have paid " | " considers the transaction as it would have paid " | ||||
"a higher (or lower) fee.\n" | "a higher (or lower) fee.\n" | ||||
"\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\" 10000") + | ||||
HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")); | HelpExampleRpc("prioritisetransaction", "\"txid\", 10000")); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
TxId txid(ParseHashStr(request.params[0].get_str(), "txid")); | TxId txid(ParseHashStr(request.params[0].get_str(), "txid")); | ||||
Amount nAmount = request.params[2].get_int64() * SATOSHI; | Amount nAmount = request.params[1].get_int64() * SATOSHI; | ||||
g_mempool.PrioritiseTransaction(txid, nAmount); | g_mempool.PrioritiseTransaction(txid, nAmount); | ||||
return true; | return true; | ||||
} | } | ||||
// NOTE: Assumes a conclusive result; if result is inconclusive, it must be | // NOTE: Assumes a conclusive result; if result is inconclusive, it must be | ||||
// handled by caller | // handled by caller | ||||
static UniValue BIP22ValidationResult(const Config &config, | static UniValue BIP22ValidationResult(const Config &config, | ||||
▲ Show 20 Lines • Show All 502 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", "dummy", "fee_delta"}}, | {"mining", "prioritisetransaction", prioritisetransaction, {"txid", "fee_delta"}}, | ||||
{"mining", "getblocktemplate", getblocktemplate, {"template_request"}}, | {"mining", "getblocktemplate", getblocktemplate, {"template_request"}}, | ||||
{"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"}}, | ||||
{"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]); | ||||
} | } |