Skip to content

Commit

Permalink
fix:staled transactions will lead to oom if the pool is always not-empty
Browse files Browse the repository at this point in the history
  • Loading branch information
andyzhang2023 committed Nov 12, 2024
1 parent 5a039c4 commit 0c34d0b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1892,6 +1892,7 @@ func (pool *LegacyPool) demoteUnexecutables(demoteAddrs []common.Address) {
}
demoteTxMeter.Mark(int64(len(demoteAddrs)))

var removed = 0
// Iterate over all accounts and demote any non-executable transactions
gasLimit := txpool.EffectiveGasLimit(pool.chainconfig, pool.currentHead.Load().GasLimit, pool.config.EffectiveGasCeil)
for _, addr := range demoteAddrs {
Expand Down Expand Up @@ -1955,7 +1956,9 @@ func (pool *LegacyPool) demoteUnexecutables(demoteAddrs []common.Address) {
}
}
pool.pendingCache.del(dropPendingCache, pool.signer)
removed += len(dropPendingCache)
}
pool.priced.Removed(removed)
}

// addressByHeartbeat is an account address tagged with its last activity timestamp.
Expand Down

0 comments on commit 0c34d0b

Please sign in to comment.