Skip to content

Commit

Permalink
Merge pull request #3881 from filcloud/issue-3626-SectorState
Browse files Browse the repository at this point in the history
fix SectorState
  • Loading branch information
magik6k authored Sep 18, 2020
2 parents 9afdda4 + d5af25b commit 7109e95
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/lotus-storage-miner/sectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import (

"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types"

lcli "github.com/filecoin-project/lotus/cli"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
)

var sectorsCmd = &cli.Command{
Expand Down Expand Up @@ -420,6 +422,10 @@ var sectorsUpdateCmd = &cli.Command{
return xerrors.Errorf("could not parse sector number: %w", err)
}

if _, ok := sealing.ExistSectorStateList[sealing.SectorState(cctx.Args().Get(1))]; !ok {
return xerrors.Errorf("Not existing sector state")
}

return nodeApi.SectorsUpdate(ctx, abi.SectorNumber(id), api.SectorState(cctx.Args().Get(1)))
},
}
Expand Down
32 changes: 32 additions & 0 deletions extern/storage-sealing/sector_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@ package sealing

type SectorState string

var ExistSectorStateList = map[SectorState]struct{}{
Empty: {},
WaitDeals: {},
Packing: {},
PreCommit1: {},
PreCommit2: {},
PreCommitting: {},
PreCommitWait: {},
WaitSeed: {},
Committing: {},
SubmitCommit: {},
CommitWait: {},
FinalizeSector: {},
Proving: {},
FailedUnrecoverable: {},
SealPreCommit1Failed: {},
SealPreCommit2Failed: {},
PreCommitFailed: {},
ComputeProofFailed: {},
CommitFailed: {},
PackingFailed: {},
FinalizeFailed: {},
DealsExpired: {},
RecoverDealIDs: {},
Faulty: {},
FaultReported: {},
FaultedFinal: {},
Removing: {},
RemoveFailed: {},
Removed: {},
}

const (
UndefinedSectorState SectorState = ""

Expand Down

0 comments on commit 7109e95

Please sign in to comment.