sector import: Add missing initial fsm state transition
This commit is contained in:
parent
fef7232c6b
commit
12a8ab5ac7
@ -182,16 +182,20 @@ func (sm *StorageMinerAPI) PledgeSector(ctx context.Context) (abi.SectorID, erro
|
||||
return abi.SectorID{}, err
|
||||
}
|
||||
|
||||
return sm.waitSectorStarted(ctx, sr.ID)
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) waitSectorStarted(ctx context.Context, si abi.SectorID) (abi.SectorID, error) {
|
||||
// wait for the sector to enter the Packing state
|
||||
// TODO: instead of polling implement some pubsub-type thing in storagefsm
|
||||
for {
|
||||
info, err := sm.Miner.SectorsStatus(ctx, sr.ID.Number, false)
|
||||
info, err := sm.Miner.SectorsStatus(ctx, si.Number, false)
|
||||
if err != nil {
|
||||
return abi.SectorID{}, xerrors.Errorf("getting pledged sector info: %w", err)
|
||||
}
|
||||
|
||||
if info.State != api.SectorState(sealing.UndefinedSectorState) {
|
||||
return sr.ID, nil
|
||||
return si, nil
|
||||
}
|
||||
|
||||
select {
|
||||
@ -449,7 +453,12 @@ func (sm *StorageMinerAPI) SectorNumFree(ctx context.Context, name string) error
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) SectorReceive(ctx context.Context, meta api.RemoteSectorMeta) error {
|
||||
return sm.Miner.Receive(ctx, meta)
|
||||
if err := sm.Miner.Receive(ctx, meta); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err := sm.waitSectorStarted(ctx, meta.Sector)
|
||||
return err
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) ComputeWindowPoSt(ctx context.Context, dlIdx uint64, tsk types.TipSetKey) ([]minertypes.SubmitWindowedPoStParams, error) {
|
||||
|
@ -50,6 +50,7 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto
|
||||
UndefinedSectorState: planOne(
|
||||
on(SectorStart{}, WaitDeals),
|
||||
on(SectorStartCC{}, Packing),
|
||||
on(SectorReceive{}, ReceiveSector),
|
||||
),
|
||||
Empty: planOne( // deprecated
|
||||
on(SectorAddPiece{}, AddPiece),
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
// todo m.inputLk?
|
||||
func (m *Sealing) Receive(ctx context.Context, meta api.RemoteSectorMeta) error {
|
||||
si, err := m.checkSectorMeta(ctx, meta)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user