Skip to content

Commit 9979f3d

Browse files
committed
[mempool] move removed and conflicts transaction ref list to vector.
1 parent 4f672c2 commit 9979f3d

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/test/mempool_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
5353

5454

5555
CTxMemPool testPool(CFeeRate(0));
56-
std::list<CTransactionRef> removed;
56+
std::vector<CTransactionRef> removed;
5757

5858
// Nothing in pool, remove should do nothing:
5959
testPool.removeRecursive(txParent, &removed);

src/txmempool.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ void CTxMemPool::CalculateDescendants(txiter entryit, setEntries &setDescendants
489489
}
490490
}
491491

492-
void CTxMemPool::removeRecursive(const CTransaction& origTx, std::list<CTransactionRef>* removed)
492+
void CTxMemPool::removeRecursive(const CTransaction& origTx, std::vector<CTransactionRef>* removed)
493493
{
494494
// Remove transaction from memory pool
495495
{
@@ -580,7 +580,7 @@ void CTxMemPool::removeWithAnchor(const uint256& invalidRoot)
580580
}
581581
}
582582

583-
void CTxMemPool::removeConflicts(const CTransaction& tx, std::list<CTransactionRef>* removed)
583+
void CTxMemPool::removeConflicts(const CTransaction& tx, std::vector<CTransactionRef>* removed)
584584
{
585585
// Remove transactions which depend on inputs of tx, recursively
586586
std::list<CTransaction> result;
@@ -612,7 +612,7 @@ void CTxMemPool::removeConflicts(const CTransaction& tx, std::list<CTransactionR
612612
* Called when a block is connected. Removes from mempool and updates the miner fee estimator.
613613
*/
614614
void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight,
615-
std::list<CTransactionRef>* conflicts, bool fCurrentEstimate)
615+
std::vector<CTransactionRef>* conflicts, bool fCurrentEstimate)
616616
{
617617
LOCK(cs);
618618
std::vector<CTxMemPoolEntry> entries;

src/txmempool.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,12 @@ class CTxMemPool
520520
// then invoke the second version.
521521
bool addUnchecked(const uint256& hash, const CTxMemPoolEntry& entry, bool fCurrentEstimate = true);
522522
bool addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, setEntries &setAncestors, bool fCurrentEstimate = true);
523-
void removeRecursive(const CTransaction& tx, std::list<CTransactionRef>* removed = nullptr);
523+
void removeRecursive(const CTransaction& tx, std::vector<CTransactionRef>* removed = nullptr);
524524
void removeForReorg(const CCoinsViewCache* pcoins, unsigned int nMemPoolHeight, int flags);
525525
void removeWithAnchor(const uint256& invalidRoot);
526-
void removeConflicts(const CTransaction& tx, std::list<CTransactionRef>* removed = nullptr);
526+
void removeConflicts(const CTransaction& tx, std::vector<CTransactionRef>* removed = nullptr);
527527
void removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight,
528-
std::list<CTransactionRef>* conflicts = nullptr, bool fCurrentEstimate = true);
528+
std::vector<CTransactionRef>* conflicts = nullptr, bool fCurrentEstimate = true);
529529
void clear();
530530
void _clear(); // lock-free
531531
bool CompareDepthAndScore(const uint256& hasha, const uint256& hashb);

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,7 @@ static int64_t nTimePostConnect = 0;
20202020
* applied to the UTXO state as a part of a single ActivateBestChainStep call.
20212021
*/
20222022
struct ConnectTrace {
2023-
std::list<CTransactionRef> txConflicted;
2023+
std::vector<CTransactionRef> txConflicted;
20242024
std::vector<std::pair<CBlockIndex*, std::shared_ptr<const CBlock> > > blocksConnected;
20252025
};
20262026

0 commit comments

Comments
 (0)