core/txpool/legacypool: reheap the tx list if london fork not enabled (#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.
pull/27508/head
jin 1 year ago committed by GitHub
parent 36ca59f1ec
commit 46ec972c9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      core/txpool/legacypool/legacypool.go

@ -1206,9 +1206,13 @@ func (pool *LegacyPool) runReorg(done chan struct{}, reset *txpoolResetRequest,
// because of another transaction (e.g. higher gas price). // because of another transaction (e.g. higher gas price).
if reset != nil { if reset != nil {
pool.demoteUnexecutables() pool.demoteUnexecutables()
if reset.newHead != nil && pool.chainconfig.IsLondon(new(big.Int).Add(reset.newHead.Number, big.NewInt(1))) { 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) pendingBaseFee := misc.CalcBaseFee(pool.chainconfig, reset.newHead)
pool.priced.SetBaseFee(pendingBaseFee) pool.priced.SetBaseFee(pendingBaseFee)
} else {
pool.priced.Reheap()
}
} }
// Update all accounts to the latest known pending nonce // Update all accounts to the latest known pending nonce
nonces := make(map[common.Address]uint64, len(pool.pending)) nonces := make(map[common.Address]uint64, len(pool.pending))

Loading…
Cancel
Save