add check GetAddressedSectorsMax
This commit is contained in:
parent
0f9d198dbd
commit
4f9119f211
@ -815,7 +815,7 @@ var sectorsRenewCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
&cli.Int64Flag{
|
&cli.Int64Flag{
|
||||||
Name: "max-sectors",
|
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{
|
&cli.BoolFlag{
|
||||||
Name: "really-do-it",
|
Name: "really-do-it",
|
||||||
@ -1025,13 +1025,17 @@ var sectorsRenewCmd = &cli.Command{
|
|||||||
for newExp, numbers := range exts {
|
for newExp, numbers := range exts {
|
||||||
scount += len(numbers)
|
scount += len(numbers)
|
||||||
var addrSectors int
|
var addrSectors int
|
||||||
if cctx.Int("max-sectors") == 0 {
|
sectorsMax, err := policy.GetAddressedSectorsMax(nv)
|
||||||
addrSectors, err = policy.GetAddressedSectorsMax(nv)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if cctx.Int("max-sectors") == 0 {
|
||||||
|
addrSectors = sectorsMax
|
||||||
} else {
|
} else {
|
||||||
addrSectors = cctx.Int("max-sectors")
|
addrSectors = cctx.Int("max-sectors")
|
||||||
|
if addrSectors > sectorsMax {
|
||||||
|
return xerrors.Errorf("the specified max-sectors exceeds the maximum limit")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declMax, err := policy.GetDeclarationsMax(nv)
|
declMax, err := policy.GetDeclarationsMax(nv)
|
||||||
|
Loading…
Reference in New Issue
Block a user