| 575 | } |
| 576 | |
| 577 | static RPCMethod getprioritisedtransactions() |
| 578 | { |
| 579 | return RPCMethod{"getprioritisedtransactions", |
| 580 | "Returns a map of all user-created (see prioritisetransaction) fee deltas by txid, and whether the tx is present in mempool.", |
| 581 | {}, |
| 582 | RPCResult{ |
| 583 | RPCResult::Type::OBJ_DYN, "", "prioritisation keyed by txid", |
| 584 | { |
| 585 | {RPCResult::Type::OBJ, "<transactionid>", "", { |
| 586 | {RPCResult::Type::NUM, "fee_delta", "transaction fee delta in satoshis"}, |
| 587 | {RPCResult::Type::BOOL, "in_mempool", "whether this transaction is currently in mempool"}, |
| 588 | {RPCResult::Type::NUM, "modified_fee", /*optional=*/true, "modified fee in satoshis. Only returned if in_mempool=true"}, |
| 589 | }} |
| 590 | }, |
| 591 | }, |
| 592 | RPCExamples{ |
| 593 | HelpExampleCli("getprioritisedtransactions", "") |
| 594 | + HelpExampleRpc("getprioritisedtransactions", "") |
| 595 | }, |
| 596 | [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue |
| 597 | { |
| 598 | NodeContext& node = EnsureAnyNodeContext(request.context); |
| 599 | CTxMemPool& mempool = EnsureMemPool(node); |
| 600 | UniValue rpc_result{UniValue::VOBJ}; |
| 601 | for (const auto& delta_info : mempool.GetPrioritisedTransactions()) { |
| 602 | UniValue result_inner{UniValue::VOBJ}; |
| 603 | result_inner.pushKV("fee_delta", delta_info.delta); |
| 604 | result_inner.pushKV("in_mempool", delta_info.in_mempool); |
| 605 | if (delta_info.in_mempool) { |
| 606 | result_inner.pushKV("modified_fee", *delta_info.modified_fee); |
| 607 | } |
| 608 | rpc_result.pushKV(delta_info.txid.GetHex(), std::move(result_inner)); |
| 609 | } |
| 610 | return rpc_result; |
| 611 | }, |
| 612 | }; |
| 613 | } |
| 614 | |
| 615 | |
| 616 | // NOTE: Assumes a conclusive result; if result is inconclusive, it must be handled by caller |
nothing calls this directly
no test coverage detected