Skip to content

Commit

Permalink
eth/catalyst: ensure TxPool is synced in Fork (ethereum#29876)
Browse files Browse the repository at this point in the history
This should fix an occasional test failure in ethclient/simulated.TestForkResendTx.
Inspection of logs revealed the cause of the failure to be that the txpool was not done
reorganizing by the time Fork is called.
  • Loading branch information
fjl authored and stwiname committed Sep 9, 2024
1 parent 0757f4d commit ddb126d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions eth/catalyst/simulated_beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,12 @@ func (c *SimulatedBeacon) Rollback() {

// Fork sets the head to the provided hash.
func (c *SimulatedBeacon) Fork(parentHash common.Hash) error {
// Ensure no pending transactions.
c.eth.TxPool().Sync()
if len(c.eth.TxPool().Pending(txpool.PendingFilter{})) != 0 {
return errors.New("pending block dirty")
}

parent := c.eth.BlockChain().GetBlockByHash(parentHash)
if parent == nil {
return errors.New("parent not found")
Expand Down

0 comments on commit ddb126d

Please sign in to comment.