Skip to content

Commit cfee082

Browse files
authored
Merge pull request #475 from OffchainLabs/backend_filter_recover
arbitrum backend: recover from failed subscription
2 parents da910f8 + 849c795 commit cfee082

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

arbitrum/backend.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/ethereum/go-ethereum/ethdb"
1616
"github.com/ethereum/go-ethereum/event"
1717
"github.com/ethereum/go-ethereum/internal/shutdowncheck"
18+
"github.com/ethereum/go-ethereum/log"
1819
"github.com/ethereum/go-ethereum/node"
1920
"github.com/ethereum/go-ethereum/rpc"
2021
)
@@ -128,7 +129,16 @@ func (b *Backend) updateFilterMapsHeads() {
128129
headEventCh := make(chan core.ChainEvent, 10)
129130
blockProcCh := make(chan bool, 10)
130131
sub := b.arb.BlockChain().SubscribeChainEvent(headEventCh)
132+
if sub == nil {
133+
log.Error("arbitrum Backend: failed subscribing to Head Event")
134+
return
135+
}
131136
sub2 := b.arb.BlockChain().SubscribeBlockProcessingEvent(blockProcCh)
137+
if sub2 == nil {
138+
log.Error("arbitrum Backend: failed subscribing to Block Processing Event")
139+
sub.Unsubscribe()
140+
return
141+
}
132142
defer func() {
133143
sub.Unsubscribe()
134144
sub2.Unsubscribe()

0 commit comments

Comments
 (0)