refactor: pass more specialized params to computeTicket
This commit is contained in:
parent
20e831b9ea
commit
3566e96b55
@ -507,7 +507,7 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *type
|
||||
rbase = bvals[len(bvals)-1]
|
||||
}
|
||||
|
||||
ticket, err := m.computeTicket(ctx, &rbase, base, mbi)
|
||||
ticket, err := m.computeTicket(ctx, &rbase, round, base.TipSet.MinTicket(), mbi)
|
||||
if err != nil {
|
||||
err = xerrors.Errorf("scratching ticket failed: %w", err)
|
||||
return nil, err
|
||||
@ -589,15 +589,14 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *type
|
||||
return minedBlock, nil
|
||||
}
|
||||
|
||||
func (m *Miner) computeTicket(ctx context.Context, brand *types.BeaconEntry, base *MiningBase, mbi *api.MiningBaseInfo) (*types.Ticket, error) {
|
||||
func (m *Miner) computeTicket(ctx context.Context, brand *types.BeaconEntry, round abi.ChainEpoch, chainRand *types.Ticket, mbi *api.MiningBaseInfo) (*types.Ticket, error) {
|
||||
buf := new(bytes.Buffer)
|
||||
if err := m.address.MarshalCBOR(buf); err != nil {
|
||||
return nil, xerrors.Errorf("failed to marshal address to cbor: %w", err)
|
||||
}
|
||||
|
||||
round := base.TipSet.Height() + base.NullRounds + 1
|
||||
if round > build.UpgradeSmokeHeight {
|
||||
buf.Write(base.TipSet.MinTicket().VRFProof)
|
||||
buf.Write(chainRand.VRFProof)
|
||||
}
|
||||
|
||||
input, err := lrand.DrawRandomness(brand.Data, crypto.DomainSeparationTag_TicketProduction, round-build.TicketRandomnessLookback, buf.Bytes())
|
||||
|
Loading…
Reference in New Issue
Block a user