Skip to content

Commit

Permalink
core/txpool/legacypool: reheap the tx list if london fork not enabled (
Browse files Browse the repository at this point in the history
…ethereum#27481)

This change ensures Reheap will be called even before the London fork activates.
Since Reheap would otherwise only be called through `SetBaseFee` after London,
the list would just keep growing if the fork was not enabled or not reached yet.
  • Loading branch information
lochjin authored and spencer-tb committed Jul 7, 2023
1 parent 0e49392 commit ee8c403
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/txpool/legacypool/legacypool.go
Expand Up @@ -1217,9 +1217,13 @@ func (pool *LegacyPool) runReorg(done chan struct{}, reset *txpoolResetRequest,
// because of another transaction (e.g. higher gas price).
if reset != nil {
pool.demoteUnexecutables()
if reset.newHead != nil && pool.chainconfig.IsLondon(new(big.Int).Add(reset.newHead.Number, big.NewInt(1))) {
pendingBaseFee := misc.CalcBaseFee(pool.chainconfig, reset.newHead)
pool.priced.SetBaseFee(pendingBaseFee)
if reset.newHead != nil {
if pool.chainconfig.IsLondon(new(big.Int).Add(reset.newHead.Number, big.NewInt(1))) {
pendingBaseFee := misc.CalcBaseFee(pool.chainconfig, reset.newHead)
pool.priced.SetBaseFee(pendingBaseFee)
} else {
pool.priced.Reheap()
}
}
// Update all accounts to the latest known pending nonce
nonces := make(map[common.Address]uint64, len(pool.pending))
Expand Down

0 comments on commit ee8c403

Please sign in to comment.