File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -890,6 +890,22 @@ void CTxMemPool::ClearPrioritisation(const uint256& hash)
890890 mapDeltas.erase (hash);
891891}
892892
893+ std::vector<CTxMemPool::delta_info> CTxMemPool::GetPrioritisedTransactions () const
894+ {
895+ AssertLockNotHeld (cs);
896+ LOCK (cs);
897+ std::vector<delta_info> result;
898+ result.reserve (mapDeltas.size ());
899+ for (const auto & [txid, delta] : mapDeltas) {
900+ const auto iter{mapTx.find (txid)};
901+ const bool in_mempool{iter != mapTx.end ()};
902+ std::optional<CAmount> modified_fee;
903+ if (in_mempool) modified_fee = iter->GetModifiedFee ();
904+ result.emplace_back (delta_info{in_mempool, delta, modified_fee, txid});
905+ }
906+ return result;
907+ }
908+
893909const CTransaction* CTxMemPool::GetConflictTx (const COutPoint& prevout) const
894910{
895911 const auto it = mapNextTx.find (prevout);
Original file line number Diff line number Diff line change @@ -516,6 +516,19 @@ class CTxMemPool
516516 void ApplyDelta (const uint256& hash, CAmount &nFeeDelta) const EXCLUSIVE_LOCKS_REQUIRED(cs);
517517 void ClearPrioritisation (const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs);
518518
519+ struct delta_info {
520+ /* * Whether this transaction is in the mempool. */
521+ const bool in_mempool;
522+ /* * The fee delta added using PrioritiseTransaction(). */
523+ const CAmount delta;
524+ /* * The modified fee (base fee + delta) of this entry. Only present if in_mempool=true. */
525+ std::optional<CAmount> modified_fee;
526+ /* * The prioritised transaction's txid. */
527+ const uint256 txid;
528+ };
529+ /* * Return a vector of all entries in mapDeltas with their corresponding delta_info. */
530+ std::vector<delta_info> GetPrioritisedTransactions () const EXCLUSIVE_LOCKS_REQUIRED(!cs);
531+
519532 /* * Get the transaction in the pool that spends the same prevout */
520533 const CTransaction* GetConflictTx (const COutPoint& prevout) const EXCLUSIVE_LOCKS_REQUIRED(cs);
521534
You can’t perform that action at this time.
0 commit comments