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] 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)