sealing: Run more checks when considering Available sectors

This commit is contained in:
Łukasz Magiera
2022-03-16 22:30:07 +01:00
parent 3c15314ed5
commit a440339548
2 changed files with 13 additions and 4 deletions
+10
View File
@@ -570,6 +570,16 @@ func (m *Sealing) tryGetUpgradeSector(ctx context.Context, sp abi.RegisteredSeal
continue
}
active, err := m.sectorActive(ctx, TipSetToken{}, s.Number)
if err != nil {
log.Errorw("checking sector active", "error", err)
continue
}
if !active {
log.Debugw("skipping available sector", "reason", "not active")
continue
}
// if best is below target, we want larger expirations
// if best is above target, we want lower pledge, but only if still above target
+3 -4
View File
@@ -3,7 +3,6 @@ package sealing
import (
"context"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
@@ -72,7 +71,7 @@ func (m *Sealing) MarkForSnapUpgrade(ctx context.Context, id abi.SectorNumber) e
return xerrors.Errorf("failed to read sector on chain info: %w", err)
}
active, err := sectorActive(ctx, m.Api, m.maddr, tok, id)
active, err := m.sectorActive(ctx, tok, id)
if err != nil {
return xerrors.Errorf("failed to check if sector is active")
}
@@ -88,8 +87,8 @@ func (m *Sealing) MarkForSnapUpgrade(ctx context.Context, id abi.SectorNumber) e
return m.sectors.Send(uint64(id), SectorMarkForUpdate{})
}
func sectorActive(ctx context.Context, api SealingAPI, maddr address.Address, tok TipSetToken, sector abi.SectorNumber) (bool, error) {
active, err := api.StateMinerActiveSectors(ctx, maddr, tok)
func (m *Sealing) sectorActive(ctx context.Context, tok TipSetToken, sector abi.SectorNumber) (bool, error) {
active, err := m.Api.StateMinerActiveSectors(ctx, m.maddr, tok)
if err != nil {
return false, xerrors.Errorf("failed to check active sectors: %w", err)
}