Commit 6265b3e9 authored by Joshua Gutow's avatar Joshua Gutow Committed by GitHub

Apply suggestions from code review

Switch to using a shared network timeout.
Co-authored-by: default avatarSebastian Stammler <seb@oplabs.co>
parent 8e1578d1
......@@ -105,14 +105,16 @@ func NewConfig(cfg CLIConfig, l log.Logger) (Config, error) {
return Config{}, err
}
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
networkTimeout := 2 * time.Second
ctx, cancel := context.WithTimeout(context.Background(), networkTimeout)
defer cancel()
l1, err := ethclient.DialContext(ctx, cfg.L1RPCURL)
if err != nil {
return Config{}, err
}
ctx, cancel = context.WithTimeout(context.Background(), 2*time.Second)
ctx, cancel = context.WithTimeout(context.Background(), networkTimeout)
defer cancel()
chainID, err := l1.ChainID(ctx)
if err != nil {
......@@ -128,7 +130,7 @@ func NewConfig(cfg CLIConfig, l log.Logger) (Config, error) {
Backend: l1,
ResubmissionTimeout: cfg.ResubmissionTimeout,
ChainID: chainID,
NetworkTimeout: 2 * time.Second,
NetworkTimeout: networkTimeout,
ReceiptQueryInterval: 30 * time.Second,
NumConfirmations: cfg.NumConfirmations,
SafeAbortNonceTooLowCount: cfg.SafeAbortNonceTooLowCount,
......
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