Skip to content

Commit 65a8cad

Browse files
committed
fix: potentially flaky testResubmitZeroGasPriceTransaction
1 parent b3d62dd commit 65a8cad

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

rollup/internal/controller/sender/sender_test.go

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,23 +287,36 @@ func testResubmitZeroGasPriceTransaction(t *testing.T) {
287287
assert.NotNil(t, tx)
288288
err = s.client.SendTransaction(s.ctx, tx)
289289
assert.NoError(t, err)
290+
291+
txHashes := []common.Hash{tx.Hash()}
290292
// Increase at least 1 wei in gas price, gas tip cap and gas fee cap.
291293
// Bumping the fees enough times to let the transaction be included in a block.
292294
for i := 0; i < 30; i++ {
293295
tx, err = s.createReplacingTransaction(tx, 0, 0)
294296
assert.NoError(t, err)
295297
err = s.client.SendTransaction(s.ctx, tx)
296298
assert.NoError(t, err)
299+
txHashes = append(txHashes, tx.Hash())
297300
}
298301

299302
assert.Eventually(t, func() bool {
300-
_, isPending, err := s.client.TransactionByHash(context.Background(), tx.Hash())
301-
return err == nil && !isPending
303+
for _, txHash := range txHashes {
304+
_, isPending, err := s.client.TransactionByHash(context.Background(), txHash)
305+
if err == nil && !isPending {
306+
return true
307+
}
308+
}
309+
return false
302310
}, 30*time.Second, time.Second)
303311

304312
assert.Eventually(t, func() bool {
305-
receipt, err := s.client.TransactionReceipt(context.Background(), tx.Hash())
306-
return err == nil && receipt != nil
313+
for _, txHash := range txHashes {
314+
receipt, err := s.client.TransactionReceipt(context.Background(), txHash)
315+
if err == nil && receipt != nil {
316+
return true
317+
}
318+
}
319+
return false
307320
}, 30*time.Second, time.Second)
308321

309322
s.Stop()

0 commit comments

Comments
 (0)