Review Response

This commit is contained in:
zenground0 2022-02-08 12:39:18 -05:00
parent 5a09b6496d
commit 1e524b7210
2 changed files with 6 additions and 8 deletions

View File

@ -121,26 +121,22 @@ func (m *Sealing) maybeStartSealing(ctx statemachine.Context, sector SectorInfo,
sealTime := time.Unix(sector.CreationTime, 0).Add(cfg.WaitDealsDelay)
// check deal age, start sealing when the deal closest to starting is within slack time
safeSealTime := sealTime
_, current, err := m.Api.ChainHead(ctx.Context())
blockTime := time.Second * time.Duration(build.BlockDelaySecs)
if err != nil {
return false, xerrors.Errorf("API error getting head: %w", err)
}
for _, piece := range sector.Pieces {
if piece.DealInfo == nil { // skip padding
if piece.DealInfo == nil {
continue
}
dealSafeSealEpoch := piece.DealInfo.DealProposal.StartEpoch - cfg.StartEpochSealingBuffer
dealSafeSealTime := time.Now().Add(time.Duration(dealSafeSealEpoch-current) * blockTime)
if dealSafeSealTime.Before(safeSealTime) {
safeSealTime = dealSafeSealTime
if dealSafeSealTime.Before(sealTime) {
sealTime = dealSafeSealTime
}
}
if safeSealTime.Before(sealTime) {
sealTime = safeSealTime
}
if now.After(sealTime) {
log.Infow("starting to seal deal sector", "sector", sector.SectorNumber, "trigger", "wait-timeout")
return true, ctx.Send(SectorStartPacking{})

View File

@ -120,7 +120,9 @@ type DealmakingConfig struct {
// This includes the time the deal will need to get transferred and published
// before being assigned to a sector
ExpectedSealDuration Duration
// Whether new sectors are sealed to pack incoming deals
// Whether new sectors are created to pack incoming deals
// When this is set to false no new sectors will be created for sealing incoming deals
// This is useful for forcing all deals to be assigned as snap deals to sectors marked for upgrade
MakeNewSectorForDeals bool
// Maximum amount of time proposed deal StartEpoch can be in future
MaxDealStartDelay Duration