mining lookback is effectively a constant - make it so

This commit is contained in:
Peter Rabbitson 2021-05-05 22:54:01 +02:00
parent 3b0fc01e82
commit 26841aa094
2 changed files with 2 additions and 13 deletions

View File

@ -187,6 +187,7 @@ func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch {
return 10
}
// NOTE: if this ever changes, adjust it in a (*Miner).mineOne() logline as well
return ChainFinality
}

View File

@ -430,24 +430,12 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (*types.BlockMsg,
// always write out a log from this point out
var winner *types.ElectionProof
lookBack := make(chan int64)
// figure this out in the background, instead of slowing down the main loop
go func() {
lb := int64(-1)
if netVer, err := m.api.StateNetworkVersion(ctx, base.TipSet.Key()); err == nil {
lb = int64(policy.GetWinningPoStSectorSetLookback(netVer))
}
lookBack <- lb
}()
defer func() {
log.Infow(
"completed mineOne",
"forRound", int64(round),
"baseEpoch", int64(base.TipSet.Height()),
"lookbackEpochs", <-lookBack,
"lookbackEpochs", int64(policy.ChainFinality), // hardcoded as it is unlikely to change again: https://github.com/filecoin-project/lotus/blob/v1.8.0/chain/actors/policy/policy.go#L180-L186
"networkPowerAtLookback", mbi.NetworkPower.String(),
"minerPowerAtLookback", mbi.MinerPower.String(),
"isEligible", mbi.EligibleForMining,