fix: sealing: Abort upgrades in sectors with no deals

This commit is contained in:
Łukasz Magiera 2022-09-14 11:35:07 +02:00
parent 4e830a8c31
commit d2c726cd28
2 changed files with 10 additions and 0 deletions

View File

@ -21,6 +21,11 @@ import (
)
func (m *Sealing) handleReplicaUpdate(ctx statemachine.Context, sector SectorInfo) error {
// if the sector ended up not having any deals, abort the upgrade
if !sector.hasDeals() {
return ctx.Send(SectorAbortUpgrade{xerrors.New("sector had no deals")})
}
if err := checkPieces(ctx.Context(), m.maddr, sector, m.Api, true); err != nil { // Sanity check state
return handleErrors(ctx, err, sector)
}

View File

@ -49,6 +49,11 @@ func (m *Sealing) handlePacking(ctx statemachine.Context, sector SectorInfo) err
delete(m.assignedPieces, m.minerSectorID(sector.SectorNumber))
m.inputLk.Unlock()
// if this is a snapdeals sector, but it ended up not having any deals, abort the upgrade
if sector.State == SnapDealsPacking && !sector.hasDeals() {
return ctx.Send(SectorAbortUpgrade{xerrors.New("sector had no deals")})
}
log.Infow("performing filling up rest of the sector...", "sector", sector.SectorNumber)
var allocated abi.UnpaddedPieceSize