Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dtynn committed Jan 20, 2020
1 parent 4436148 commit b2fcca8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions storage/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ func (m *Miner) Run(ctx context.Context) error {
evts := events.NewEvents(ctx, m.api)
m.sealing = sealing.New(m.api, evts, m.maddr, m.worker, m.ds, m.sb, m.tktFn)

go m.sealing.Run(ctx)

return nil
}

Expand Down
7 changes: 5 additions & 2 deletions storage/sealing/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ var fsmPlanners = []func(events []statemachine.Event, state *SectorInfo) error{
on(SectorPreCommitFailed{}, api.PreCommitFailed),
),
api.Committing: planCommitting,
api.CommitWait: planOne(on(SectorProving{}, api.Proving)),
api.CommitWait: planOne(
on(SectorProving{}, api.Proving),
on(SectorCommitFailed{}, api.CommitFailed),
),

api.Proving: planOne(
on(SectorFaultReported{}, api.FaultReported),
Expand Down Expand Up @@ -238,6 +241,6 @@ func planOne(ts ...func() (mut mutator, next api.SectorState)) func(events []sta
return nil
}

return xerrors.Errorf("planner for state %s received unexpected event %+v", events[0])
return xerrors.Errorf("planner for state %s received unexpected event %+v", api.SectorStates[state.State], events[0])
}
}
4 changes: 4 additions & 0 deletions storage/sealing/fsm_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ func (evt SectorSeedReady) apply(state *SectorInfo) {
}

type SectorSealCommitFailed struct{ error }

type SectorCommitFailed struct{ error }

func (evt SectorCommitFailed) apply(*SectorInfo) {}

type SectorCommitted struct {
message cid.Cid
proof []byte
Expand Down
2 changes: 0 additions & 2 deletions storage/sealing/sealing.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ func New(api sealingApi, events *events.Events, maddr address.Address, worker ad
}

func (m *Sealing) Run(ctx context.Context) error {
m.events = events.NewEvents(ctx, m.api)

if err := m.restartSectors(ctx); err != nil {
log.Errorf("%+v", err)
return xerrors.Errorf("failed load sector states: %w", err)
Expand Down

0 comments on commit b2fcca8

Please sign in to comment.