fix(ticketfn): getting a ticket should take tipset identifier

This commit is contained in:
laser 2020-04-07 13:26:43 -07:00
parent 7c7b9b6a63
commit 55e54593cc
2 changed files with 8 additions and 2 deletions

View File

@ -47,6 +47,12 @@ func (m *Sealing) handlePacking(ctx statemachine.Context, sector SectorInfo) err
}
func (m *Sealing) handlePreCommit1(ctx statemachine.Context, sector SectorInfo) error {
tok, _, err := m.api.ChainHead(ctx.Context())
if err != nil {
log.Errorf("handlePreCommit1: api error, not proceeding: %+v", err)
return nil
}
if err := checkPieces(ctx.Context(), sector, m.api); err != nil { // Sanity check state
switch err.(type) {
case *ErrApi:
@ -62,7 +68,7 @@ func (m *Sealing) handlePreCommit1(ctx statemachine.Context, sector SectorInfo)
}
log.Infow("performing sector replication...", "sector", sector.SectorNumber)
ticketValue, ticketEpoch, err := m.tktFn(ctx.Context())
ticketValue, ticketEpoch, err := m.tktFn(ctx.Context(), tok)
if err != nil {
return ctx.Send(SectorSealPreCommitFailed{xerrors.Errorf("getting ticket failed: %w", err)})
}

View File

@ -98,7 +98,7 @@ func (t *SectorInfo) existingPieces() []abi.UnpaddedPieceSize {
return out
}
type TicketFn func(context.Context) (abi.SealRandomness, abi.ChainEpoch, error)
type TicketFn func(ctx context.Context, tok TipSetToken) (abi.SealRandomness, abi.ChainEpoch, error)
type SectorIDCounter interface {
Next() (abi.SectorNumber, error)