mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-11 05:03:16 +01:00
[refactor] Add helper for iterating through mempool entries
Instead of reaching into the mapTx data structure, use a helper method that provides the required vector of CTxMemPoolEntry pointers.
This commit is contained in:
@@ -836,6 +836,18 @@ static TxMempoolInfo GetInfo(CTxMemPool::indexed_transaction_set::const_iterator
|
||||
return TxMempoolInfo{it->GetSharedTx(), it->GetTime(), it->GetFee(), it->GetTxSize(), it->GetModifiedFee() - it->GetFee()};
|
||||
}
|
||||
|
||||
std::vector<CTxMemPoolEntryRef> CTxMemPool::entryAll() const
|
||||
{
|
||||
AssertLockHeld(cs);
|
||||
|
||||
std::vector<CTxMemPoolEntryRef> ret;
|
||||
ret.reserve(mapTx.size());
|
||||
for (const auto& it : GetSortedDepthAndScore()) {
|
||||
ret.emplace_back(*it);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<TxMempoolInfo> CTxMemPool::infoAll() const
|
||||
{
|
||||
LOCK(cs);
|
||||
|
||||
Reference in New Issue
Block a user