diff --git a/storage/pipeline/input.go b/storage/pipeline/input.go index e86f7b9a954..3b46a7d8a56 100644 --- a/storage/pipeline/input.go +++ b/storage/pipeline/input.go @@ -550,12 +550,13 @@ func (m *Sealing) calcTargetExpiration(ctx context.Context, ssize abi.SectorSize } } + ts, err := m.Api.ChainHead(ctx) + if err != nil { + return 0, 0, xerrors.Errorf("getting current epoch: %w", err) + } + // if the sector isn't full, use max deal duration as the target if !full { - ts, err := m.Api.ChainHead(ctx) - if err != nil { - return 0, 0, xerrors.Errorf("getting current epoch: %w", err) - } minDur, maxDur := policy.DealDurationBounds(0) minExp = ts.Height() + minDur @@ -569,11 +570,11 @@ func (m *Sealing) calcTargetExpiration(ctx context.Context, ssize abi.SectorSize } // apply user minimums - if abi.ChainEpoch(cfg.MinUpgradeSectorExpiration) > minExp { - minExp = abi.ChainEpoch(cfg.MinUpgradeSectorExpiration) + if abi.ChainEpoch(cfg.MinUpgradeSectorExpiration)+ts.Height() > minExp { + minExp = abi.ChainEpoch(cfg.MinUpgradeSectorExpiration) + ts.Height() } - if abi.ChainEpoch(cfg.MinTargetUpgradeSectorExpiration) > target { - target = abi.ChainEpoch(cfg.MinTargetUpgradeSectorExpiration) + if abi.ChainEpoch(cfg.MinTargetUpgradeSectorExpiration)+ts.Height() > target { + target = abi.ChainEpoch(cfg.MinTargetUpgradeSectorExpiration) + ts.Height() } return minExp, target, nil