sealing: Fix build

This commit is contained in:
Łukasz Magiera 2022-03-16 20:09:18 +01:00
parent 724d80cf02
commit aac1f5abef
3 changed files with 15 additions and 12 deletions

View File

@ -573,21 +573,24 @@ func (m *Sealing) tryGetUpgradeSector(ctx context.Context, sp abi.RegisteredSeal
continue continue
} }
slowChecks := func() bool {
active, err := m.sectorActive(ctx, TipSetToken{}, s.Number) active, err := m.sectorActive(ctx, TipSetToken{}, s.Number)
if err != nil { if err != nil {
log.Errorw("checking sector active", "error", err) log.Errorw("checking sector active", "error", err)
continue return false
} }
if !active { if !active {
log.Debugw("skipping available sector", "reason", "not active") log.Debugw("skipping available sector", "reason", "not active")
continue return false
}
return true
} }
// if best is below target, we want larger expirations // if best is below target, we want larger expirations
// if best is above target, we want lower pledge, but only if still above target // if best is above target, we want lower pledge, but only if still above target
if bestExpiration < targetExpiration { if bestExpiration < targetExpiration {
if expiration > bestExpiration { if expiration > bestExpiration && slowChecks() {
bestExpiration = expiration bestExpiration = expiration
bestPledge = pledge bestPledge = pledge
candidate = s candidate = s
@ -595,7 +598,7 @@ func (m *Sealing) tryGetUpgradeSector(ctx context.Context, sp abi.RegisteredSeal
continue continue
} }
if expiration >= targetExpiration && pledge.LessThan(bestPledge) { if expiration >= targetExpiration && pledge.LessThan(bestPledge) && slowChecks() {
bestExpiration = expiration bestExpiration = expiration
bestPledge = pledge bestPledge = pledge
candidate = s candidate = s

View File

@ -238,7 +238,7 @@ func (m *Sealing) handleSubmitReplicaUpdateFailed(ctx statemachine.Context, sect
} }
// Abort upgrade for sectors that went faulty since being marked for upgrade // Abort upgrade for sectors that went faulty since being marked for upgrade
active, err := sectorActive(ctx.Context(), m.Api, m.maddr, tok, sector.SectorNumber) active, err := m.sectorActive(ctx.Context(), tok, sector.SectorNumber)
if err != nil { if err != nil {
log.Errorf("sector active check: api error, not proceeding: %+v", err) log.Errorf("sector active check: api error, not proceeding: %+v", err)
return nil return nil

View File

@ -41,7 +41,7 @@ func (m *Sealing) handleProveReplicaUpdate(ctx statemachine.Context, sector Sect
log.Errorf("handleProveReplicaUpdate: api error, not proceeding: %+v", err) log.Errorf("handleProveReplicaUpdate: api error, not proceeding: %+v", err)
return nil return nil
} }
active, err := sectorActive(ctx.Context(), m.Api, m.maddr, tok, sector.SectorNumber) active, err := m.sectorActive(ctx.Context(), tok, sector.SectorNumber)
if err != nil { if err != nil {
log.Errorf("sector active check: api error, not proceeding: %+v", err) log.Errorf("sector active check: api error, not proceeding: %+v", err)
return nil return nil