From f6cbe6217a704f3eac0a766efa8894e8d3e97944 Mon Sep 17 00:00:00 2001 From: Frrist Date: Wed, 29 Jun 2022 13:19:22 -0700 Subject: [PATCH] fix: prevent panic on parent miner state nil (#1013) --- tasks/actorstate/miner/sector_events.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tasks/actorstate/miner/sector_events.go b/tasks/actorstate/miner/sector_events.go index f4ef0efac..0b2d38e49 100644 --- a/tasks/actorstate/miner/sector_events.go +++ b/tasks/actorstate/miner/sector_events.go @@ -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) @@ -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 }