Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1827,6 +1827,16 @@ func (t *lookup) Remove(hash common.Hash) {
delete(t.txs, hash)
}

// Clear resets the lookup structure, removing all stored entries.
func (t *lookup) Clear() {
t.lock.Lock()
defer t.lock.Unlock()

t.slots = 0
t.txs = make(map[common.Hash]*types.Transaction)
t.auths = make(map[common.Address][]common.Hash)
}

// TxsBelowTip finds all remote transactions below the given tip threshold.
func (t *lookup) TxsBelowTip(threshold *big.Int) types.Transactions {
found := make(types.Transactions, 0, 128)
Expand Down Expand Up @@ -1923,7 +1933,7 @@ func (pool *LegacyPool) Clear() {
for addr := range pool.queue {
pool.reserver.Release(addr)
}
pool.all = newLookup()
pool.all.Clear()
pool.priced = newPricedList(pool.all)
pool.pending = make(map[common.Address]*list)
pool.queue = make(map[common.Address]*list)
Expand Down