Skip to content

Commit 1d07b90

Browse files
committed
refactor: errorPairPtr to errorPair
1 parent f5b2309 commit 1d07b90

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

aggregator/pkg/subscriber.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ package pkg
33
import "github.com/yetanotherco/aligned_layer/core/chainio"
44

55
func (agg *Aggregator) SubscribeToNewTasks() *chainio.ErrorPair {
6-
errorPairPtr := agg.subscribeToNewTasks()
7-
if errorPairPtr != nil {
8-
return errorPairPtr
6+
errorPair := agg.subscribeToNewTasks()
7+
if errorPair != nil {
8+
return errorPair
99
}
1010

1111
for {
1212
select {
1313
case err := <-agg.taskSubscriber:
1414
agg.AggregatorConfig.BaseConfig.Logger.Info("Failed to subscribe to new tasks", "err", err)
15-
errorPairPtr = agg.subscribeToNewTasks()
16-
if errorPairPtr != nil {
17-
return errorPairPtr
15+
errorPair = agg.subscribeToNewTasks()
16+
if errorPair != nil {
17+
return errorPair
1818
}
1919
case newBatch := <-agg.NewBatchChan:
2020
agg.AggregatorConfig.BaseConfig.Logger.Info("Adding new task")
@@ -24,11 +24,11 @@ func (agg *Aggregator) SubscribeToNewTasks() *chainio.ErrorPair {
2424
}
2525

2626
func (agg *Aggregator) subscribeToNewTasks() *chainio.ErrorPair {
27-
errorPairPtr := agg.avsSubscriber.SubscribeToNewTasksV3(agg.NewBatchChan, agg.taskSubscriber)
27+
errorPair := agg.avsSubscriber.SubscribeToNewTasksV3(agg.NewBatchChan, agg.taskSubscriber)
2828

29-
if errorPairPtr != nil {
30-
agg.AggregatorConfig.BaseConfig.Logger.Info("Failed to create task subscriber", "err", errorPairPtr)
29+
if errorPair != nil {
30+
agg.AggregatorConfig.BaseConfig.Logger.Info("Failed to create task subscriber", "err", errorPair)
3131
}
3232

33-
return errorPairPtr
33+
return errorPair
3434
}

operator/pkg/operator.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ func (o *Operator) UpdateLastProcessBatch(blockNumber uint32) error {
207207
func (o *Operator) Start(ctx context.Context) error {
208208
// create a new channel to foward errors
209209
subV2ErrorChannel := make(chan chainio.ErrorPair)
210-
errorPairPtr := o.SubscribeToNewTasksV2(subV2ErrorChannel)
211-
if errorPairPtr != nil {
210+
errorPair := o.SubscribeToNewTasksV2(subV2ErrorChannel)
211+
if errorPair != nil {
212212
log.Fatal("Could not subscribe to new tasks")
213213
}
214214

215215
subV3ErrorChannel := make(chan chainio.ErrorPair)
216-
errorPairPtr = o.SubscribeToNewTasksV3(subV3ErrorChannel)
217-
if errorPairPtr != nil {
216+
errorPair = o.SubscribeToNewTasksV3(subV3ErrorChannel)
217+
if errorPair != nil {
218218
log.Fatal("Could not subscribe to new tasks")
219219
}
220220

@@ -236,14 +236,14 @@ func (o *Operator) Start(ctx context.Context) error {
236236
o.Logger.Errorf("Metrics server failed", "err", err)
237237
case errorPair := <-subV2ErrorChannel:
238238
o.Logger.Infof("Error in websocket subscription", "err", errorPair)
239-
errorPairPtr = o.SubscribeToNewTasksV2(subV2ErrorChannel)
240-
if errorPairPtr != nil {
239+
errorPair = o.SubscribeToNewTasksV2(subV2ErrorChannel)
240+
if errorPair != nil {
241241
o.Logger.Fatal("Could not subscribe to new tasks V2")
242242
}
243243
case errorPair := <-subV3ErrorChannel:
244244
o.Logger.Infof("Error in websocket subscription", "err", errorPair)
245-
errorPairPtr = o.SubscribeToNewTasksV3(subV3ErrorChannel)
246-
if errorPairPtr != nil {
245+
errorPair = o.SubscribeToNewTasksV3(subV3ErrorChannel)
246+
if errorPair != nil {
247247
o.Logger.Fatal("Could not subscribe to new tasks V3")
248248
}
249249
case newBatchLogV2 := <-o.NewTaskCreatedChanV2:

0 commit comments

Comments
 (0)