add Dealmaking.StartEpochSealingBuffer config

This commit is contained in:
Anton Evangelatov
2021-10-01 17:44:15 +02:00
committed by Łukasz Magiera
parent c2fa54ca9c
commit 809289f5ef
9 changed files with 45 additions and 15 deletions
+6 -1
View File
@@ -274,11 +274,16 @@ func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPiec
return api.SectorOffset{}, xerrors.Errorf("getting proposal CID: %w", err)
}
cfg, err := m.getConfig()
if err != nil {
return api.SectorOffset{}, xerrors.Errorf("getting config: %w", err)
}
_, head, err := m.Api.ChainHead(ctx)
if err != nil {
return api.SectorOffset{}, xerrors.Errorf("couldnt get chain head: %w", err)
}
if head > deal.DealProposal.StartEpoch {
if head+cfg.StartEpochSealingBuffer > deal.DealProposal.StartEpoch {
return api.SectorOffset{}, xerrors.Errorf(
"cannot add piece for deal with piece CID %s: current epoch %d has passed deal proposal start epoch %d",
deal.DealProposal.PieceCID, head, deal.DealProposal.StartEpoch)
+2
View File
@@ -22,6 +22,8 @@ type Config struct {
CommittedCapacitySectorLifetime time.Duration
StartEpochSealingBuffer abi.ChainEpoch
AlwaysKeepUnsealedCopy bool
FinalizeEarly bool