Skip to content

Commit

Permalink
Merge pull request #10611 from filecoin-project/fix/check-sector-exists
Browse files Browse the repository at this point in the history
fix: cli: Check if the sectorID exists before removing
  • Loading branch information
magik6k authored Apr 4, 2023
2 parents 740a7ca + d211b5e commit 4394187
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/lotus-miner/sectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
},
}
Expand Down

0 comments on commit 4394187

Please sign in to comment.