Commit 8b5e3c26 authored by Sebastian Stammler's avatar Sebastian Stammler Committed by GitHub

op-e2e: harden WaitForTransaction against tx indexing in progress errors (#10600)

this is a new error by geth that hasn't an exported error type yet, but
it indicates that geth is still indexing and so one more try is worth
it.
parent f706f061
...@@ -5,6 +5,7 @@ import ( ...@@ -5,6 +5,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"math/big" "math/big"
"strings"
"time" "time"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
...@@ -16,10 +17,10 @@ import ( ...@@ -16,10 +17,10 @@ import (
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
) )
var ( const errStrTxIdxingInProgress = "transaction indexing is in progress"
// errTimeout represents a timeout
errTimeout = errors.New("timeout") // errTimeout represents a timeout
) var errTimeout = errors.New("timeout")
func WaitForL1OriginOnL2(rollupCfg *rollup.Config, l1BlockNum uint64, client *ethclient.Client, timeout time.Duration) (*types.Block, error) { func WaitForL1OriginOnL2(rollupCfg *rollup.Config, l1BlockNum uint64, client *ethclient.Client, timeout time.Duration) (*types.Block, error) {
timeoutCh := time.After(timeout) timeoutCh := time.After(timeout)
...@@ -65,7 +66,8 @@ func WaitForTransaction(hash common.Hash, client *ethclient.Client, timeout time ...@@ -65,7 +66,8 @@ func WaitForTransaction(hash common.Hash, client *ethclient.Client, timeout time
receipt, err := client.TransactionReceipt(ctx, hash) receipt, err := client.TransactionReceipt(ctx, hash)
if receipt != nil && err == nil { if receipt != nil && err == nil {
return receipt, nil return receipt, nil
} else if err != nil && !errors.Is(err, ethereum.NotFound) { } else if err != nil &&
!(errors.Is(err, ethereum.NotFound) || strings.Contains(err.Error(), errStrTxIdxingInProgress)) {
return nil, err return nil, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment