Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 262 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
// 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() != 3) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"prioritisetransaction <txid> <dummy> <fee delta>\n" | "prioritisetransaction <txid> <dummy value> <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. dummy (numeric, optional) API-Compatibility for " | ||||
"previous API. Must be zero or null.\n" | |||||
" DEPRECATED. For forward compatibility use named " | |||||
"arguments and omit this parameter.\n" | |||||
"3. 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\" 0.0 10000") + | ||||
HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")); | HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 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[2].get_int64() * SATOSHI; | ||||
if (!(request.params[1].isNull() || request.params[1].get_real() == 0)) { | |||||
throw JSONRPCError(RPC_INVALID_PARAMETER, | |||||
"Priority is no longer supported, dummy argument to " | |||||
"prioritisetransaction must be 0."); | |||||
} | |||||
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, | ||||
const CValidationState &state) { | const CValidationState &state) { | ||||
▲ Show 20 Lines • Show All 525 Lines • Show Last 20 Lines |