Merge pull request #6066 from chadwick2143/extend-v1-sectors
Fix bugs in sectors extend --v1-sectors
This commit is contained in:
commit
e983d90a28
@ -438,6 +438,12 @@ var sectorsExtendCmd = &cli.Command{
|
|||||||
Usage: "when extending v1 sectors, don't try to extend sectors by fewer than this number of epochs",
|
Usage: "when extending v1 sectors, don't try to extend sectors by fewer than this number of epochs",
|
||||||
Required: false,
|
Required: false,
|
||||||
},
|
},
|
||||||
|
&cli.Int64Flag{
|
||||||
|
Name: "expiration-ignore",
|
||||||
|
Value: 120,
|
||||||
|
Usage: "when extending v1 sectors, skip sectors whose current expiration is less than <ignore> epochs from now",
|
||||||
|
Required: false,
|
||||||
|
},
|
||||||
&cli.Int64Flag{
|
&cli.Int64Flag{
|
||||||
Name: "expiration-cutoff",
|
Name: "expiration-cutoff",
|
||||||
Usage: "when extending v1 sectors, skip sectors whose current expiration is more than <cutoff> epochs from now (infinity if unspecified)",
|
Usage: "when extending v1 sectors, skip sectors whose current expiration is more than <cutoff> epochs from now (infinity if unspecified)",
|
||||||
@ -496,6 +502,10 @@ var sectorsExtendCmd = &cli.Command{
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if si.Expiration < (head.Height() + abi.ChainEpoch(cctx.Int64("expiration-ignore"))) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if cctx.IsSet("expiration-cutoff") {
|
if cctx.IsSet("expiration-cutoff") {
|
||||||
if si.Expiration > (head.Height() + abi.ChainEpoch(cctx.Int64("expiration-cutoff"))) {
|
if si.Expiration > (head.Height() + abi.ChainEpoch(cctx.Int64("expiration-cutoff"))) {
|
||||||
continue
|
continue
|
||||||
@ -510,6 +520,10 @@ var sectorsExtendCmd = &cli.Command{
|
|||||||
|
|
||||||
// Set the new expiration to 48 hours less than the theoretical maximum lifetime
|
// Set the new expiration to 48 hours less than the theoretical maximum lifetime
|
||||||
newExp := ml - (miner3.WPoStProvingPeriod * 2) + si.Activation
|
newExp := ml - (miner3.WPoStProvingPeriod * 2) + si.Activation
|
||||||
|
if withinTolerance(si.Expiration, newExp) || si.Expiration >= newExp {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
p, err := api.StateSectorPartition(ctx, maddr, si.SectorNumber, types.EmptyTSK)
|
p, err := api.StateSectorPartition(ctx, maddr, si.SectorNumber, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("getting sector location for sector %d: %w", si.SectorNumber, err)
|
return xerrors.Errorf("getting sector location for sector %d: %w", si.SectorNumber, err)
|
||||||
@ -527,7 +541,7 @@ var sectorsExtendCmd = &cli.Command{
|
|||||||
} else {
|
} else {
|
||||||
added := false
|
added := false
|
||||||
for exp := range es {
|
for exp := range es {
|
||||||
if withinTolerance(exp, newExp) {
|
if withinTolerance(exp, newExp) && newExp >= exp && exp > si.Expiration {
|
||||||
es[exp] = append(es[exp], uint64(si.SectorNumber))
|
es[exp] = append(es[exp], uint64(si.SectorNumber))
|
||||||
added = true
|
added = true
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user