Skip to content

Commit

Permalink
Check if sector exists before changing its state
Browse files Browse the repository at this point in the history
  • Loading branch information
geoff-vball committed Dec 17, 2021
1 parent a0d76bd commit 27e48d7
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 27e48d7

Please sign in to comment.