Skip to content

Commit

Permalink
mining lookback is effectively a constant - make it so
Browse files Browse the repository at this point in the history
  • Loading branch information
ribasushi committed May 5, 2021
1 parent fffd024 commit 594bf1d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
1 change: 1 addition & 0 deletions chain/actors/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
14 changes: 1 addition & 13 deletions miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,24 +432,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,
Expand Down

0 comments on commit 594bf1d

Please sign in to comment.