Merge pull request #7762 from filecoin-project/feat/sectors-update-state-guard

sectors update-state checks if sector exists before changing its state
This commit is contained in:
Aayush Rajasekaran 2021-12-17 19:21:26 -05:00 committed by GitHub
commit dd20829dbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)