lotus/extern/storage-sealing/states_proving.go

41 lines
1.3 KiB
Go
Raw Normal View History

2020-06-22 16:42:38 +00:00
package sealing
import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-statemachine"
)
func (m *Sealing) handleFaulty(ctx statemachine.Context, sector SectorInfo) error {
2020-06-22 16:44:28 +00:00
// TODO: noop because this is now handled by the PoSt scheduler. We can reuse
// this state for tracking faulty sectors, or remove it when that won't be
// a breaking change
return nil
2020-06-22 16:42:38 +00:00
}
func (m *Sealing) handleFaultReported(ctx statemachine.Context, sector SectorInfo) error {
if sector.FaultReportMsg == nil {
return xerrors.Errorf("entered fault reported state without a FaultReportMsg cid")
}
mw, err := m.api.StateWaitMsg(ctx.Context(), *sector.FaultReportMsg)
if err != nil {
return xerrors.Errorf("failed to wait for fault declaration: %w", err)
}
if mw.Receipt.ExitCode != 0 {
log.Errorf("UNHANDLED: declaring sector fault failed (exit=%d, msg=%s) (id: %d)", mw.Receipt.ExitCode, *sector.FaultReportMsg, sector.SectorNumber)
return xerrors.Errorf("UNHANDLED: submitting fault declaration failed (exit %d)", mw.Receipt.ExitCode)
}
return ctx.Send(SectorFaultedFinal{})
}
func (m *Sealing) handleRemoving(ctx statemachine.Context, sector SectorInfo) error {
if err := m.sealer.Remove(ctx.Context(), m.minerSector(sector.SectorType, sector.SectorNumber)); err != nil {
2020-06-22 16:42:38 +00:00
return ctx.Send(SectorRemoveFailed{err})
}
return ctx.Send(SectorRemoved{})
}