Skip to content

Commit

Permalink
fix: prevent panic on parent miner state nil (#1013)
Browse files Browse the repository at this point in the history
  • Loading branch information
frrist authored Jun 29, 2022
1 parent c249b67 commit f6cbe62
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tasks/actorstate/miner/sector_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func (SectorEventsExtractor) Extract(ctx context.Context, a actorstate.ActorInfo

var sectorChanges *miner.SectorChanges
var preCommitChanges *miner.PreCommitChanges
var deadlineChanges miner.DeadlinesDiff
if extState.ParentState() == nil {
// If the miner doesn't have previous state list all of its current sectors and precommits
sectors, err := extState.CurrentState().LoadSectors(nil)
Expand Down Expand Up @@ -64,14 +65,14 @@ func (SectorEventsExtractor) Extract(ctx context.Context, a actorstate.ActorInfo
if err != nil {
return nil, err
}
}

dlDiff, err := miner.DiffDeadlines(extState.ParentState(), extState.CurrentState())
if err != nil {
return nil, err
deadlineChanges, err = miner.DiffDeadlines(extState.ParentState(), extState.CurrentState())
if err != nil {
return nil, err
}
}

sectorEventModel, err := ExtractSectorEvents(ctx, extState, sectorChanges, preCommitChanges, dlDiff)
sectorEventModel, err := ExtractSectorEvents(ctx, extState, sectorChanges, preCommitChanges, deadlineChanges)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit f6cbe62

Please sign in to comment.