Skip to content

Commit

Permalink
avoid cleaning up duplicate addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
bharath-123 committed Jan 9, 2025
1 parent db74619 commit 0b92dde
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,7 @@ func (pool *LegacyPool) truncateQueue() {
// it assumes that the pool lock is being held
func (pool *LegacyPool) clearPendingAndQueued(newHead *types.Header) {
// Iterate over all accounts and demote any non-executable transactions
addrsForWhichTxsRemoved := []common.Address{}
addrsForWhichTxsRemoved := map[common.Address]bool{}

for addr, list := range pool.pending {
dropped, invalids := list.ClearList()
Expand All @@ -1800,7 +1800,7 @@ func (pool *LegacyPool) clearPendingAndQueued(newHead *types.Header) {
delete(pool.pending, addr)
delete(pool.beats, addr)

addrsForWhichTxsRemoved = append(addrsForWhichTxsRemoved, addr)
addrsForWhichTxsRemoved[addr] = true
}
}

Expand All @@ -1817,10 +1817,12 @@ func (pool *LegacyPool) clearPendingAndQueued(newHead *types.Header) {

if list.Empty() {
delete(pool.queue, addr)

addrsForWhichTxsRemoved[addr] = true
}
}

for _, addr := range addrsForWhichTxsRemoved {
for addr := range addrsForWhichTxsRemoved {
pool.reserve(addr, false)
}
}
Expand Down

0 comments on commit 0b92dde

Please sign in to comment.