From 2cb3c89570932ce58e6c5ea5f40e4f7523a28207 Mon Sep 17 00:00:00 2001 From: chadwick2143 Date: Tue, 20 Apr 2021 14:00:01 +0800 Subject: [PATCH 1/2] Fix bugs in sectors extend --v1-sectors --- cmd/lotus-storage-miner/sectors.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cmd/lotus-storage-miner/sectors.go b/cmd/lotus-storage-miner/sectors.go index 3791dbf0741..961a279cf79 100644 --- a/cmd/lotus-storage-miner/sectors.go +++ b/cmd/lotus-storage-miner/sectors.go @@ -435,6 +435,12 @@ var sectorsExtendCmd = &cli.Command{ Usage: "when extending v1 sectors, don't try to extend sectors by fewer than this number of epochs", Required: false, }, + &cli.Int64Flag{ + Name: "expiration-ignore", + Value: 120, + Usage: "when extending v1 sectors, skip sectors whose current expiration is less than epochs from now", + Required: false, + }, &cli.Int64Flag{ Name: "expiration-cutoff", Usage: "when extending v1 sectors, skip sectors whose current expiration is more than epochs from now (infinity if unspecified)", @@ -493,6 +499,10 @@ var sectorsExtendCmd = &cli.Command{ continue } + if si.Expiration < (head.Height() + abi.ChainEpoch(cctx.Int64("expiration-ignore"))) { + continue + } + if cctx.IsSet("expiration-cutoff") { if si.Expiration > (head.Height() + abi.ChainEpoch(cctx.Int64("expiration-cutoff"))) { continue @@ -507,6 +517,10 @@ var sectorsExtendCmd = &cli.Command{ // Set the new expiration to 48 hours less than the theoretical maximum lifetime 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) if err != nil { return xerrors.Errorf("getting sector location for sector %d: %w", si.SectorNumber, err) @@ -524,7 +538,7 @@ var sectorsExtendCmd = &cli.Command{ } else { added := false 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)) added = true break From ea9ad8c5a89c543cc3f539855e52bb1dc3af8ddb Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Sun, 11 Jul 2021 13:01:19 -0400 Subject: [PATCH 2/2] Update cmd/lotus-storage-miner/sectors.go --- cmd/lotus-storage-miner/sectors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/lotus-storage-miner/sectors.go b/cmd/lotus-storage-miner/sectors.go index 961a279cf79..a3a24cc9684 100644 --- a/cmd/lotus-storage-miner/sectors.go +++ b/cmd/lotus-storage-miner/sectors.go @@ -538,7 +538,7 @@ var sectorsExtendCmd = &cli.Command{ } else { added := false for exp := range es { - if withinTolerance(exp, newExp) && newExp > exp && exp > si.Expiration { + if withinTolerance(exp, newExp) && newExp >= exp && exp > si.Expiration { es[exp] = append(es[exp], uint64(si.SectorNumber)) added = true break