aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.cpp
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2023-04-16 09:05:01 +0100
committerglozow <gloriajzhao@gmail.com>2023-05-10 21:10:44 +0100
commit9e9ca36c80013749faaf2aa777d52bd07d9d24ec (patch)
tree0e595739215e1b54bec44298e2782a66d6bce9ce /src/txmempool.cpp
parentccd4db7d62e4880005da49f820a520a8943dcaed (diff)
[mempool] add GetPrioritisedTransactions
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r--src/txmempool.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index da875c271e..0d85d1d135 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -890,6 +890,22 @@ void CTxMemPool::ClearPrioritisation(const uint256& hash)
mapDeltas.erase(hash);
}
+std::vector<CTxMemPool::delta_info> CTxMemPool::GetPrioritisedTransactions() const
+{
+ AssertLockNotHeld(cs);
+ LOCK(cs);
+ std::vector<delta_info> result;
+ result.reserve(mapDeltas.size());
+ for (const auto& [txid, delta] : mapDeltas) {
+ const auto iter{mapTx.find(txid)};
+ const bool in_mempool{iter != mapTx.end()};
+ std::optional<CAmount> modified_fee;
+ if (in_mempool) modified_fee = iter->GetModifiedFee();
+ result.emplace_back(delta_info{in_mempool, delta, modified_fee, txid});
+ }
+ return result;
+}
+
const CTransaction* CTxMemPool::GetConflictTx(const COutPoint& prevout) const
{
const auto it = mapNextTx.find(prevout);