Skip to content

Commit

Permalink
Add nil check for aggregation (#246)
Browse files Browse the repository at this point in the history
* Add nil check for aggregation

* Continue without error
  • Loading branch information
mikhailUshakoff authored Jun 7, 2024
1 parent 50a6bdd commit 456804d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions aggregator/database/database.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package database

import (
"context"
"errors"
"log"
"math"
Expand Down Expand Up @@ -295,13 +296,21 @@ func (d *Database) FetchCheckpointMessages(fromTimestamp uint64, toTimestamp uin
operatorSetUpdateMessageAggregations := make([]messages.MessageBlsAggregation, 0, len(operatorSetUpdates))

for _, stateRootUpdate := range stateRootUpdates {
if stateRootUpdate.Aggregation == nil {
d.db.Logger.Warn(context.Background(), "Aggregation is nil for stateRootUpdate: %v", stateRootUpdate)
continue
}
agg := stateRootUpdate.Aggregation

stateRootUpdateMessages = append(stateRootUpdateMessages, stateRootUpdate.ToMessage())
stateRootUpdateMessageAggregations = append(stateRootUpdateMessageAggregations, agg.ToMessage())
}

for _, operatorSetUpdate := range operatorSetUpdates {
if operatorSetUpdate.Aggregation == nil {
d.db.Logger.Warn(context.Background(), "Aggregation is nil for operatorSetUpdate: %v", operatorSetUpdate)
continue
}
agg := operatorSetUpdate.Aggregation

operatorSetUpdateMessages = append(operatorSetUpdateMessages, operatorSetUpdate.ToMessage())
Expand Down

0 comments on commit 456804d

Please sign in to comment.