[rpc] add getprioritisedtransactions
This allows the user to see prioritisation for not-in-mempool transactions.
This commit is contained in:
1 parent
9e9ca36c80
commit
99f8046829
3 files changed
+39
No files matched your search
@@ -0,0 +1,3 @@
|
|||||||
|
- A new `getprioritisedtransactions` RPC has been added. It returns a map of all fee deltas created by the
|
||||||
|
user with prioritisetransaction, indexed by txid. The map also indicates whether each transaction is
|
||||||
|
present in the mempool.
|
||||||
@@ -480,6 +480,40 @@ static RPCHelpMan prioritisetransaction()
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static RPCHelpMan getprioritisedtransactions()
|
||||||
|
{
|
||||||
|
return RPCHelpMan{"getprioritisedtransactions",
|
||||||
|
"Returns a map of all user-created (see prioritisetransaction) fee deltas by txid, and whether the tx is present in mempool.",
|
||||||
|
{},
|
||||||
|
RPCResult{
|
||||||
|
RPCResult::Type::OBJ_DYN, "prioritisation-map", "prioritisation keyed by txid",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::OBJ, "txid", "", {
|
||||||
|
{RPCResult::Type::NUM, "fee_delta", "transaction fee delta in satoshis"},
|
||||||
|
{RPCResult::Type::BOOL, "in_mempool", "whether this transaction is currently in mempool"},
|
||||||
|
}}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
RPCExamples{
|
||||||
|
HelpExampleCli("getprioritisedtransactions", "")
|
||||||
|
+ HelpExampleRpc("getprioritisedtransactions", "")
|
||||||
|
},
|
||||||
|
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||||
|
{
|
||||||
|
NodeContext& node = EnsureAnyNodeContext(request.context);
|
||||||
|
CTxMemPool& mempool = EnsureMemPool(node);
|
||||||
|
UniValue rpc_result{UniValue::VOBJ};
|
||||||
|
for (const auto& delta_info : mempool.GetPrioritisedTransactions()) {
|
||||||
|
UniValue result_inner{UniValue::VOBJ};
|
||||||
|
result_inner.pushKV("fee_delta", delta_info.delta);
|
||||||
|
result_inner.pushKV("in_mempool", delta_info.in_mempool);
|
||||||
|
rpc_result.pushKV(delta_info.txid.GetHex(), result_inner);
|
||||||
|
}
|
||||||
|
return rpc_result;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// NOTE: Assumes a conclusive result; if result is inconclusive, it must be handled by caller
|
// NOTE: Assumes a conclusive result; if result is inconclusive, it must be handled by caller
|
||||||
static UniValue BIP22ValidationResult(const BlockValidationState& state)
|
static UniValue BIP22ValidationResult(const BlockValidationState& state)
|
||||||
@@ -1048,6 +1082,7 @@ void RegisterMiningRPCCommands(CRPCTable& t)
|
|||||||
{"mining", &getnetworkhashps},
|
{"mining", &getnetworkhashps},
|
||||||
{"mining", &getmininginfo},
|
{"mining", &getmininginfo},
|
||||||
{"mining", &prioritisetransaction},
|
{"mining", &prioritisetransaction},
|
||||||
|
{"mining", &getprioritisedtransactions},
|
||||||
{"mining", &getblocktemplate},
|
{"mining", &getblocktemplate},
|
||||||
{"mining", &submitblock},
|
{"mining", &submitblock},
|
||||||
{"mining", &submitheader},
|
{"mining", &submitheader},
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ const std::vector<std::string> RPC_COMMANDS_SAFE_FOR_FUZZING{
|
|||||||
"getnetworkinfo",
|
"getnetworkinfo",
|
||||||
"getnodeaddresses",
|
"getnodeaddresses",
|
||||||
"getpeerinfo",
|
"getpeerinfo",
|
||||||
|
"getprioritisedtransactions",
|
||||||
"getrawmempool",
|
"getrawmempool",
|
||||||
"getrawtransaction",
|
"getrawtransaction",
|
||||||
"getrpcinfo",
|
"getrpcinfo",
|
||||||
|
|||||||
Reference in new issue
Block a user