add exist sector state check

This commit is contained in:
Frank
2020-09-16 19:49:45 +08:00
parent c9a8f3b8a0
commit ed74091c20
2 changed files with 39 additions and 0 deletions
+6
View File
@@ -17,6 +17,8 @@ import (
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
lcli "github.com/filecoin-project/lotus/cli"
)
@@ -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)))
},
}