Merge pull request #9941 from beck-8/feat/add_renew_max_sectors

add renew max-sectors flag
This commit is contained in:
Łukasz Magiera 2023-01-04 14:45:30 +01:00 committed by GitHub
commit 273184b084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -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.", Usage: "use up to this amount of FIL for one message. pass this flag to avoid message congestion.",
Value: "0", Value: "0",
}, },
&cli.Int64Flag{
Name: "max-sectors",
Usage: "the maximum number of sectors contained in each message message",
},
&cli.BoolFlag{ &cli.BoolFlag{
Name: "really-do-it", Name: "really-do-it",
Usage: "pass this flag to really renew sectors, otherwise will only print out json representation of parameters", 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 l, exts := range extensions {
for newExp, numbers := range exts { for newExp, numbers := range exts {
scount += len(numbers) scount += len(numbers)
addrSectors, err := policy.GetAddressedSectorsMax(nv) var addrSectors int
sectorsMax, err := policy.GetAddressedSectorsMax(nv)
if err != nil { if err != nil {
return err 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) declMax, err := policy.GetDeclarationsMax(nv)
if err != nil { if err != nil {
return err return err

View File

@ -1897,6 +1897,7 @@ OPTIONS:
--extension value try to extend selected sectors by this number of epochs, defaults to 540 days (default: 1555200) --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], <from> defaults to: now + 120 (1 hour) (default: 0) --from value only consider sectors whose current expiration epoch is in the range of [from, to], <from> 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-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) --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) --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) --really-do-it pass this flag to really renew sectors, otherwise will only print out json representation of parameters (default: false)