Skip to content

Commit

Permalink
Merge pull request #7762 from filecoin-project/feat/sectors-update-st…
Browse files Browse the repository at this point in the history
…ate-guard

sectors update-state checks if sector exists before changing its state
  • Loading branch information
arajasek authored Dec 18, 2021
2 parents 94e1a83 + 27e48d7 commit dd20829
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/lotus-miner/sectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,11 @@ var sectorsUpdateCmd = &cli.Command{
return xerrors.Errorf("could not parse sector number: %w", err)
}

_, err = nodeApi.SectorsStatus(ctx, abi.SectorNumber(id), false)
if err != nil {
return xerrors.Errorf("sector %d not found, could not change state", id)
}

newState := cctx.Args().Get(1)
if _, ok := sealing.ExistSectorStateList[sealing.SectorState(newState)]; !ok {
fmt.Printf(" \"%s\" is not a valid state. Possible states for sectors are: \n", newState)
Expand Down

0 comments on commit dd20829

Please sign in to comment.