From 27e48d73dd3f2f34d1c552d04dace588941a103f Mon Sep 17 00:00:00 2001 From: gstuart Date: Fri, 10 Dec 2021 21:04:32 -0500 Subject: [PATCH] Check if sector exists before changing its state --- cmd/lotus-miner/sectors.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/lotus-miner/sectors.go b/cmd/lotus-miner/sectors.go index 43a71fd9e..b2059a737 100644 --- a/cmd/lotus-miner/sectors.go +++ b/cmd/lotus-miner/sectors.go @@ -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)