Skip to content

Commit 9b4eab6

Browse files
authored
eth/catalyst: in tests, manually sync txpool after initial chain insertion to prevent race between txpool head reset and promotion of txs that will be subsequently added (#31595)
before this changes, this will result in numerous test failures: ``` > go test -run=Eth2AssembleBlock -c > stress ./catalyst.test ``` The reason is that after creating/inserting the test chain, there is a race between the txpool head reset and the promotion of txs added from tests. Ensuring that the txpool state is up to date with the head of the chain before proceeding fixes these flaky tests.
1 parent 4906c99 commit 9b4eab6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

eth/catalyst/api_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,9 @@ func startEthService(t *testing.T, genesis *core.Genesis, blocks []*types.Block)
447447
n.Close()
448448
t.Fatal("can't import test blocks:", err)
449449
}
450+
if err := ethservice.TxPool().Sync(); err != nil {
451+
t.Fatal("failed to sync txpool after initial blockchain import:", err)
452+
}
450453

451454
ethservice.SetSynced()
452455
return n, ethservice

0 commit comments

Comments
 (0)