NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts
| 478 | |
| 479 | // NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts |
| 480 | static RPCHelpMan prioritisetransaction() |
| 481 | { |
| 482 | return RPCHelpMan{"prioritisetransaction", |
| 483 | "Accepts the transaction into mined blocks at a higher (or lower) priority\n", |
| 484 | { |
| 485 | {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id."}, |
| 486 | {"dummy", RPCArg::Type::NUM, RPCArg::Optional::OMITTED_NAMED_ARG, "API-Compatibility for previous API. Must be zero or null.\n" |
| 487 | " DEPRECATED. For forward compatibility use named arguments and omit this parameter."}, |
| 488 | {"fee_delta", RPCArg::Type::NUM, RPCArg::Optional::NO, "The fee value (in satoshis) to add (or subtract, if negative).\n" |
| 489 | " Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.\n" |
| 490 | " The fee is not actually paid, only the algorithm for selecting transactions into a block\n" |
| 491 | " considers the transaction as it would have paid a higher (or lower) fee."}, |
| 492 | }, |
| 493 | RPCResult{ |
| 494 | RPCResult::Type::BOOL, "", "Returns true"}, |
| 495 | RPCExamples{ |
| 496 | HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000") |
| 497 | + HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000") |
| 498 | }, |
| 499 | [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue |
| 500 | { |
| 501 | LOCK(cs_main); |
| 502 | |
| 503 | uint256 hash(ParseHashV(request.params[0], "txid")); |
| 504 | CAmount nAmount = request.params[2].get_int64(); |
| 505 | |
| 506 | if (!(request.params[1].isNull() || request.params[1].get_real() == 0)) { |
| 507 | throw JSONRPCError(RPC_INVALID_PARAMETER, "Priority is no longer supported, dummy argument to prioritisetransaction must be 0."); |
| 508 | } |
| 509 | |
| 510 | EnsureAnyMemPool(request.context).PrioritiseTransaction(hash, nAmount); |
| 511 | return true; |
| 512 | }, |
| 513 | }; |
| 514 | } |
| 515 | |
| 516 | |
| 517 | // NOTE: Assumes a conclusive result; if result is inconclusive, it must be handled by caller |
nothing calls this directly
no test coverage detected