Skip to content

Commit

Permalink
txpool: reheap the priced list if london fork not enabled (bnb-chain#…
Browse files Browse the repository at this point in the history
  • Loading branch information
j75689 committed Aug 31, 2022
1 parent f2b1f3f commit f457598
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions core/tx_pool.go
Expand Up @@ -1224,10 +1224,17 @@ func (pool *TxPool) runReorg(done chan struct{}, reset *txpoolResetRequest, dirt
// 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))) {
// london fork enabled, reset given the base fee
pendingBaseFee := misc.CalcBaseFee(pool.chainconfig, reset.newHead)
pool.priced.SetBaseFee(pendingBaseFee)
} else {
// london fork not enabled, reheap to "reset" the priced list
pool.priced.Reheap()
}
}

// Update all accounts to the latest known pending nonce
nonces := make(map[common.Address]uint64, len(pool.pending))
for addr, list := range pool.pending {
Expand Down

0 comments on commit f457598

Please sign in to comment.