MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / prioritisetransaction

Function prioritisetransaction

src/rpc/mining.cpp:532–575  ·  view source on GitHub ↗

NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts

Source from the content-addressed store, hash-verified

530
531// NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts
532static RPCMethod prioritisetransaction()
533{
534 return RPCMethod{"prioritisetransaction",
535 "Accepts the transaction into mined blocks at a higher (or lower) priority\n",
536 {
537 {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id."},
538 {"dummy", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "API-Compatibility for previous API. Must be zero or null.\n"
539 " DEPRECATED. For forward compatibility use named arguments and omit this parameter."},
540 {"fee_delta", RPCArg::Type::NUM, RPCArg::Optional::NO, "The fee value (in satoshis) to add (or subtract, if negative).\n"
541 " Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.\n"
542 " The fee is not actually paid, only the algorithm for selecting transactions into a block\n"
543 " considers the transaction as it would have paid a higher (or lower) fee."},
544 },
545 RPCResult{
546 RPCResult::Type::BOOL, "", "Returns true"},
547 RPCExamples{
548 HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000")
549 + HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")
550 },
551 [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
552{
553 LOCK(cs_main);
554
555 auto txid{Txid::FromUint256(ParseHashV(request.params[0], "txid"))};
556 const auto dummy{self.MaybeArg<double>("dummy")};
557 CAmount nAmount = request.params[2].getInt<int64_t>();
558
559 if (dummy && *dummy != 0) {
560 throw JSONRPCError(RPC_INVALID_PARAMETER, "Priority is no longer supported, dummy argument to prioritisetransaction must be 0.");
561 }
562
563 CTxMemPool& mempool = EnsureAnyMemPool(request.context);
564
565 // Non-0 fee dust transactions are not allowed for entry, and modification not allowed afterwards
566 const auto& tx = mempool.get(txid);
567 if (mempool.m_opts.require_standard && tx && !GetDust(*tx, mempool.m_opts.dust_relay_feerate).empty()) {
568 throw JSONRPCError(RPC_INVALID_PARAMETER, "Priority is not supported for transactions with dust outputs.");
569 }
570
571 mempool.PrioritiseTransaction(txid, nAmount);
572 return true;
573},
574 };
575}
576
577static RPCMethod getprioritisedtransactions()
578{

Callers

nothing calls this directly

Calls 8

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
ParseHashVFunction · 0.85
JSONRPCErrorFunction · 0.85
GetDustFunction · 0.85
PrioritiseTransactionMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected