From 41f1c74ae2d00e72a8058414bf974aba57441c6c Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 11 Aug 2020 21:14:37 -0700 Subject: [PATCH] Set a minimum sector lifetime --- extern/storage-fsm/states_sealing.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extern/storage-fsm/states_sealing.go b/extern/storage-fsm/states_sealing.go index b0e5c498c..bea411715 100644 --- a/extern/storage-fsm/states_sealing.go +++ b/extern/storage-fsm/states_sealing.go @@ -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)}) } + // 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{ Expiration: expiration, SectorNumber: sector.SectorNumber,