diff --git a/cmd/lotus-miner/sectors.go b/cmd/lotus-miner/sectors.go index 3bb904d7aa9..fc5fdcef62d 100644 --- a/cmd/lotus-miner/sectors.go +++ b/cmd/lotus-miner/sectors.go @@ -813,6 +813,10 @@ var sectorsRenewCmd = &cli.Command{ Usage: "use up to this amount of FIL for one message. pass this flag to avoid message congestion.", Value: "0", }, + &cli.Int64Flag{ + Name: "max-sectors", + Usage: "the maximum number of sectors contained in each message message", + }, &cli.BoolFlag{ Name: "really-do-it", Usage: "pass this flag to really renew sectors, otherwise will only print out json representation of parameters", @@ -1020,10 +1024,20 @@ var sectorsRenewCmd = &cli.Command{ for l, exts := range extensions { for newExp, numbers := range exts { scount += len(numbers) - addrSectors, err := policy.GetAddressedSectorsMax(nv) + var addrSectors int + sectorsMax, err := policy.GetAddressedSectorsMax(nv) if err != nil { return err } + if cctx.Int("max-sectors") == 0 { + addrSectors = sectorsMax + } else { + addrSectors = cctx.Int("max-sectors") + if addrSectors > sectorsMax { + return xerrors.Errorf("the specified max-sectors exceeds the maximum limit") + } + } + declMax, err := policy.GetDeclarationsMax(nv) if err != nil { return err diff --git a/documentation/en/cli-lotus-miner.md b/documentation/en/cli-lotus-miner.md index b666d8ca723..4b705adad5c 100644 --- a/documentation/en/cli-lotus-miner.md +++ b/documentation/en/cli-lotus-miner.md @@ -1897,6 +1897,7 @@ OPTIONS: --extension value try to extend selected sectors by this number of epochs, defaults to 540 days (default: 1555200) --from value only consider sectors whose current expiration epoch is in the range of [from, to], defaults to: now + 120 (1 hour) (default: 0) --max-fee value use up to this amount of FIL for one message. pass this flag to avoid message congestion. (default: "0") + --max-sectors value the maximum number of sectors contained in each message message (default: 0) --new-expiration value try to extend selected sectors to this epoch, ignoring extension (default: 0) --only-cc only extend CC sectors (useful for making sector ready for snap upgrade) (default: false) --really-do-it pass this flag to really renew sectors, otherwise will only print out json representation of parameters (default: false)