Use correct SealRandomnessLookbackLimit

This commit is contained in:
Łukasz Magiera 2020-06-03 14:14:06 +02:00
parent 1467fe4226
commit 7fc7221348
3 changed files with 10 additions and 6 deletions

View File

@ -80,7 +80,7 @@ func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, t
return &ErrBadCommD{xerrors.Errorf("on chain CommD differs from sector: %s != %s", commD, si.CommD)}
}
if int64(height)-int64(si.TicketEpoch+SealRandomnessLookback) > SealRandomnessLookbackLimit {
if height-si.TicketEpoch+SealRandomnessLookback > SealRandomnessLookbackLimit(si.SectorType) {
return &ErrExpiredTicket{xerrors.Errorf("ticket expired: seal height: %d, head: %d", si.TicketEpoch+SealRandomnessLookback, height)}
}

View File

@ -1,13 +1,17 @@
package sealing
// Epochs
const Finality = 500
import (
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
)
// Epochs
const SealRandomnessLookback = Finality
const SealRandomnessLookback = miner.ChainFinalityish
// Epochs
const SealRandomnessLookbackLimit = SealRandomnessLookback + 2000
func SealRandomnessLookbackLimit(spt abi.RegisteredProof) abi.ChainEpoch {
return miner.MaxSealDuration[spt]
}
// Epochs
const InteractivePoRepConfidence = 6

View File

@ -53,7 +53,7 @@ func (m *Sealing) getTicket(ctx statemachine.Context, sector SectorInfo) (abi.Se
return nil, 0, nil
}
ticketEpoch := epoch - miner.ChainFinalityish
ticketEpoch := epoch - SealRandomnessLookback
buf := new(bytes.Buffer)
if err := m.maddr.MarshalCBOR(buf); err != nil {
return nil, 0, err