Set a minimum sector lifetime

This commit is contained in:
Steven Allen 2020-08-11 21:14:37 -07:00
parent e18904bff5
commit 41f1c74ae2

View File

@ -159,6 +159,13 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
return ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("handlePreCommitting: failed to compute pre-commit expiry: %w", err)}) return ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("handlePreCommitting: failed to compute pre-commit expiry: %w", err)})
} }
// Sectors must last _at least_ MinSectorExpiration + MaxSealDuration.
// TODO: The "+10" allows the pre-commit to take 10 blocks to be accepted.
if minExpiration := height + miner.MaxSealDuration[sector.SectorType] + miner.MinSectorExpiration + 10; expiration < minExpiration {
expiration = minExpiration
}
// TODO: enforce a reasonable _maximum_ sector lifetime?
params := &miner.SectorPreCommitInfo{ params := &miner.SectorPreCommitInfo{
Expiration: expiration, Expiration: expiration,
SectorNumber: sector.SectorNumber, SectorNumber: sector.SectorNumber,