Commit 535d4bb1 authored by OptimismBot's avatar OptimismBot Committed by GitHub

Merge pull request #6707 from ethereum-optimism/jg/txmgr_harden

op-service: Harden Transaction Manager
parents c501244f 90449eb7
......@@ -159,7 +159,7 @@ func TestSend(t *testing.T) {
{sendErr: true},
{},
},
nonces: []uint64{0, 1, 1},
nonces: []uint64{0, 1},
total: 3 * time.Second,
},
}
......
......@@ -17,6 +17,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-service/backoff"
"github.com/ethereum-optimism/optimism/op-service/txmgr/metrics"
)
......@@ -175,7 +176,13 @@ func (m *SimpleTxManager) send(ctx context.Context, candidate TxCandidate) (*typ
ctx, cancel = context.WithTimeout(ctx, m.cfg.TxSendTimeout)
defer cancel()
}
tx, err := m.craftTx(ctx, candidate)
tx, err := backoff.Do(ctx, 30, backoff.Fixed(2*time.Second), func() (*types.Transaction, error) {
tx, err := m.craftTx(ctx, candidate)
if err != nil {
m.l.Warn("Failed to create a transaction, will retry", "err", err)
}
return tx, err
})
if err != nil {
return nil, fmt.Errorf("failed to create the tx: %w", 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