Add CLI command to manually start sealing a sector

This commit is contained in:
Aayush Rajasekaran 2020-07-03 17:05:59 -04:00
parent 655d6f6720
commit 45fdcaea45

View File

@ -29,6 +29,7 @@ var sectorsCmd = &cli.Command{
sectorsPledgeCmd, sectorsPledgeCmd,
sectorsRemoveCmd, sectorsRemoveCmd,
sectorsMarkForUpgradeCmd, sectorsMarkForUpgradeCmd,
sectorsStartSealCmd,
}, },
} }
@ -268,6 +269,30 @@ var sectorsMarkForUpgradeCmd = &cli.Command{
}, },
} }
var sectorsStartSealCmd = &cli.Command{
Name: "seal",
Usage: "Manually start sealing a sector (filling any unused space with junk)",
ArgsUsage: "<sectorNum>",
Action: func(cctx *cli.Context) error {
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
ctx := lcli.ReqContext(cctx)
if cctx.Args().Len() != 1 {
return xerrors.Errorf("must pass sector number")
}
id, err := strconv.ParseUint(cctx.Args().Get(0), 10, 64)
if err != nil {
return xerrors.Errorf("could not parse sector number: %w", err)
}
return nodeApi.SectorStartSealing(ctx, abi.SectorNumber(id))
},
}
var sectorsUpdateCmd = &cli.Command{ var sectorsUpdateCmd = &cli.Command{
Name: "update-state", Name: "update-state",
Usage: "ADVANCED: manually update the state of a sector, this may aid in error recovery", Usage: "ADVANCED: manually update the state of a sector, this may aid in error recovery",