From 6bb13e8e2be3aa8c41460eb11837baba514e19be Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 29 May 2024 15:56:52 +0200 Subject: [PATCH] eth/catalyst: ensure TxPool is synced in Fork (#29876) 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. --- eth/catalyst/simulated_beacon.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eth/catalyst/simulated_beacon.go b/eth/catalyst/simulated_beacon.go index fecd83f276..2d6569e422 100644 --- a/eth/catalyst/simulated_beacon.go +++ b/eth/catalyst/simulated_beacon.go @@ -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")