Skip to content

Commit 7a0133b

Browse files
committed
RPC/Mining: Include priority delta in getprioritisedtransactions result
1 parent 6180638 commit 7a0133b

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

src/rpc/mining.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ static RPCHelpMan getprioritisedtransactions()
516516
{RPCResult::Type::NUM, "fee_delta", "transaction fee delta in satoshis"},
517517
{RPCResult::Type::BOOL, "in_mempool", "whether this transaction is currently in mempool"},
518518
{RPCResult::Type::NUM, "modified_fee", /*optional=*/true, "modified fee in satoshis. Only returned if in_mempool=true"},
519+
{RPCResult::Type::NUM, "priority_delta", /*optional=*/true, "transaction coin-age priority delta"},
519520
}}
520521
},
521522
},
@@ -535,6 +536,7 @@ static RPCHelpMan getprioritisedtransactions()
535536
if (delta_info.in_mempool) {
536537
result_inner.pushKV("modified_fee", *delta_info.modified_fee);
537538
}
539+
result_inner.pushKV("priority_delta", delta_info.priority_delta);
538540
rpc_result.pushKV(delta_info.txid.GetHex(), std::move(result_inner));
539541
}
540542
return rpc_result;

src/txmempool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ std::vector<CTxMemPool::delta_info> CTxMemPool::GetPrioritisedTransactions() con
952952
const bool in_mempool{iter != mapTx.end()};
953953
std::optional<CAmount> modified_fee;
954954
if (in_mempool) modified_fee = iter->GetModifiedFee();
955-
result.emplace_back(delta_info{in_mempool, delta.second, modified_fee, txid});
955+
result.emplace_back(delta_info{in_mempool, delta.second, delta.first, modified_fee, txid});
956956
}
957957
return result;
958958
}

src/txmempool.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ class CTxMemPool
502502
const bool in_mempool;
503503
/** The fee delta added using PrioritiseTransaction(). */
504504
const CAmount delta;
505+
const double priority_delta;
505506
/** The modified fee (base fee + delta) of this entry. Only present if in_mempool=true. */
506507
std::optional<CAmount> modified_fee;
507508
/** The prioritised transaction's txid. */

test/functional/test_framework/test_node.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,14 @@ def generatetodescriptor(self, *args, invalid_call, **kwargs):
364364
assert not invalid_call
365365
return self.__getattr__('generatetodescriptor')(*args, **kwargs)
366366

367+
def getprioritisedtransactions(self, *args, **kwargs):
368+
res = self.__getattr__('getprioritisedtransactions')(*args, **kwargs)
369+
assert not (args or kwargs)
370+
for res_val in res.values():
371+
if res_val['priority_delta'] == 0:
372+
del res_val['priority_delta']
373+
return res
374+
367375
def setmocktime(self, timestamp):
368376
"""Wrapper for setmocktime RPC, sets self.mocktime"""
369377
if timestamp == 0:

0 commit comments

Comments
 (0)