Skip to content

Commit

Permalink
Merge pull request #4643 from filecoin-project/fix/fsm-ticket-loop
Browse files Browse the repository at this point in the history
storagefsm: Fix GetTicket loop when the sector is already precommitted
  • Loading branch information
magik6k authored Oct 29, 2020
2 parents dc5d631 + 33459f1 commit ee814fb
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions extern/storage-sealing/states_sealing.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,25 @@ func (m *Sealing) handlePreCommit1(ctx statemachine.Context, sector SectorInfo)
}
}

_, height, err := m.api.ChainHead(ctx.Context())
tok, height, err := m.api.ChainHead(ctx.Context())
if err != nil {
log.Errorf("handlePreCommit1: api error, not proceeding: %+v", err)
return nil
}

if height-sector.TicketEpoch > MaxTicketAge {
return ctx.Send(SectorOldTicket{})
pci, err := m.api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, tok)
if err != nil {
log.Errorf("getting precommit info: %+v", err)
}

if pci == nil {
return ctx.Send(SectorOldTicket{}) // go get new ticket
}

// TODO: allow configuring expected seal durations, if we're here, it's
// pretty unlikely that we'll precommit on time (unless the miner
// process has just restarted and the worker had the result ready)
}

pc1o, err := m.sealer.SealPreCommit1(sector.sealingCtx(ctx.Context()), m.minerSector(sector.SectorNumber), sector.TicketValue, sector.pieceInfos())
Expand Down

0 comments on commit ee814fb

Please sign in to comment.