Skip to content

Commit 04d3f91

Browse files
PlasmaPowerhkalodner
authored andcommitted
Cleanly handle L1 connections that don't support subscriptions
1 parent 3c31c92 commit 04d3f91

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

arbnode/l1reader.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import (
1010
"github.com/ethereum/go-ethereum/common"
1111
"github.com/ethereum/go-ethereum/core/types"
1212
"github.com/ethereum/go-ethereum/log"
13+
"github.com/ethereum/go-ethereum/rpc"
1314
"github.com/offchainlabs/nitro/arbutil"
1415
"github.com/offchainlabs/nitro/util"
16+
"github.com/pkg/errors"
1517
flag "github.com/spf13/pflag"
1618
)
1719

@@ -201,8 +203,10 @@ func (s *L1Reader) broadcastLoop(ctx context.Context) {
201203
clientSubscription, err = s.client.SubscribeNewHead(ctx, inputChannel)
202204
if err != nil {
203205
clientSubscription = nil
204-
if time.Now().After(nextSubscribeErr) {
205-
log.Error("failed subscribing to header", "err", err)
206+
if errors.Is(err, rpc.ErrNotificationsUnsupported) {
207+
s.config.PollOnly = true
208+
} else if time.Now().After(nextSubscribeErr) {
209+
log.Warn("failed subscribing to header", "err", err)
206210
nextSubscribeErr = time.Now().Add(s.config.SubscribeErrInterval)
207211
}
208212
}

0 commit comments

Comments
 (0)