Skip to content

Commit

Permalink
op-e2e: harden WaitForTransaction against tx indexing in progress err…
Browse files Browse the repository at this point in the history
…ors (#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.
  • Loading branch information
sebastianst authored May 21, 2024
1 parent f706f06 commit 8b5e3c2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions op-e2e/e2eutils/geth/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"math/big"
"strings"
"time"

"github.com/ethereum-optimism/optimism/op-node/rollup"
Expand All @@ -16,10 +17,10 @@ import (
"github.com/ethereum/go-ethereum/rpc"
)

var (
// errTimeout represents a timeout
errTimeout = errors.New("timeout")
)
const errStrTxIdxingInProgress = "transaction indexing is in progress"

// 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) {
timeoutCh := time.After(timeout)
Expand Down Expand Up @@ -65,7 +66,8 @@ func WaitForTransaction(hash common.Hash, client *ethclient.Client, timeout time
receipt, err := client.TransactionReceipt(ctx, hash)
if receipt != nil && err == 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
}

Expand Down

0 comments on commit 8b5e3c2

Please sign in to comment.