Merge pull request #10611 from filecoin-project/fix/check-sector-exists

fix: cli: Check if the sectorID exists before removing
This commit is contained in:
Łukasz Magiera 2023-04-04 09:55:36 +02:00 committed by GitHub
commit 43941876f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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