From 0f9d198dbd8992e98fb47fc59bc052078dd7d9d3 Mon Sep 17 00:00:00 2001 From: beck <1504068285@qq.com> Date: Sun, 25 Dec 2022 21:05:44 +0800 Subject: [PATCH 1/3] add renew max-sectors flag --- cmd/lotus-miner/sectors.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cmd/lotus-miner/sectors.go b/cmd/lotus-miner/sectors.go index 3bb904d7a..a9e7f78a3 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,16 @@ var sectorsRenewCmd = &cli.Command{ for l, exts := range extensions { for newExp, numbers := range exts { scount += len(numbers) - addrSectors, err := policy.GetAddressedSectorsMax(nv) - if err != nil { - return err + var addrSectors int + if cctx.Int("max-sectors") == 0 { + addrSectors, err = policy.GetAddressedSectorsMax(nv) + if err != nil { + return err + } + } else { + addrSectors = cctx.Int("max-sectors") } + declMax, err := policy.GetDeclarationsMax(nv) if err != nil { return err From 4f9119f2117cfa1dd71ca40782f3b5a228ad9c82 Mon Sep 17 00:00:00 2001 From: beck <1504068285@qq.com> Date: Wed, 4 Jan 2023 19:39:40 +0800 Subject: [PATCH 2/3] add check GetAddressedSectorsMax --- cmd/lotus-miner/sectors.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cmd/lotus-miner/sectors.go b/cmd/lotus-miner/sectors.go index a9e7f78a3..fc5fdcef6 100644 --- a/cmd/lotus-miner/sectors.go +++ b/cmd/lotus-miner/sectors.go @@ -815,7 +815,7 @@ var sectorsRenewCmd = &cli.Command{ }, &cli.Int64Flag{ Name: "max-sectors", - Usage: "The maximum number of sectors contained in each message message", + Usage: "the maximum number of sectors contained in each message message", }, &cli.BoolFlag{ Name: "really-do-it", @@ -1025,13 +1025,17 @@ var sectorsRenewCmd = &cli.Command{ for newExp, numbers := range exts { scount += len(numbers) var addrSectors int + sectorsMax, err := policy.GetAddressedSectorsMax(nv) + if err != nil { + return err + } if cctx.Int("max-sectors") == 0 { - addrSectors, err = policy.GetAddressedSectorsMax(nv) - if err != nil { - return err - } + 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) From f3b5c767098187421962aaedea071ac073b689ec Mon Sep 17 00:00:00 2001 From: beck <1504068285@qq.com> Date: Wed, 4 Jan 2023 19:56:45 +0800 Subject: [PATCH 3/3] make docsgen-cli --- documentation/en/cli-lotus-miner.md | 1 + 1 file changed, 1 insertion(+) diff --git a/documentation/en/cli-lotus-miner.md b/documentation/en/cli-lotus-miner.md index b666d8ca7..4b705adad 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)