actually call finalizeSector

This commit is contained in:
Łukasz Magiera 2020-01-29 23:37:31 +01:00
parent 4ce9d005dd
commit c4e9a77be4
2 changed files with 8 additions and 2 deletions

2
fsm.go
View File

@ -155,7 +155,7 @@ func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(sta
case api.CommitWait:
return m.handleCommitWait, nil
case api.FinalizeSector:
return m.handleFinalizeSector, nil
case api.Proving:
// TODO: track sector health / expiration
log.Infof("Proving sector %d", state.SectorID)

View File

@ -233,8 +233,14 @@ func (m *Sealing) handleCommitWait(ctx statemachine.Context, sector SectorInfo)
}
func (m *Sealing) handleFinalizeSector(ctx statemachine.Context, sector SectorInfo) error {
// TODO: Maybe wait for some finality
if err := m.sb.FinalizeSector(ctx.Context(), sector.SectorID); err != nil {
return ctx.Send(SectorCommitFailed{err})
return ctx.Send(SectorCommitFailed{xerrors.Errorf("finalize sector: %w", err)})
}
if err := m.sb.DropStaged(ctx.Context(), sector.SectorID); err != nil {
return ctx.Send(SectorCommitFailed{xerrors.Errorf("drop staged: %w", err)})
}
return ctx.Send(SectorFinalized{})