fix: cli: Check if the sector exists
Check if the sector exists before running `SectorRemove`, and error out if the SectorID has not bee created.
This commit is contained in:
parent
740a7ca142
commit
d211b5eb69
@ -1392,6 +1392,12 @@ var sectorsRemoveCmd = &cli.Command{
|
||||
return xerrors.Errorf("could not parse sector number: %w", err)
|
||||
}
|
||||
|
||||
// Check if the sector exists
|
||||
_, err = minerAPI.SectorsStatus(ctx, abi.SectorNumber(id), false)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("sectorID %d has not been created yet: %w", id, err)
|
||||
}
|
||||
|
||||
return minerAPI.SectorRemove(ctx, abi.SectorNumber(id))
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user