HomePhabricator

txpool: add a fast path in TxPool::EraseForBlock when the pool is empty

Description

txpool: add a fast path in TxPool::EraseForBlock when the pool is empty

Summary:
This is inspired by core#32827 and D13214:

orphanage: avoid vtx iteration when no orphans

We can avoid a costly iteration over all transaction inputs in a block if we already know that we don't have any txs to erase in our pool.
The subsequent call to TxPool::EraseTxNoLock would also be a no-op with an early return (if (m_pool_txs.find(txid) == m_pool_txs.end()) return 0;)

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18986

Details

Provenance
PiRKAuthored on Sun, Nov 23, 08:01
PiRKPushed on Mon, Nov 24, 08:58
Reviewer
Restricted Project
Differential Revision
D18986: txpool: add a fast path in TxPool::EraseForBlock when the pool is empty
Parents
rABCcb23f84d8fff: [Automated] Update seeds
Branches
Unknown
Tags
Unknown