feat: miner: log detailed timing breakdown when mining takes longer than the block's timestamp

This commit is contained in:
Aayush 2023-08-31 10:28:38 -04:00
parent d71d647aaf
commit f3b3ff0dd2

View File

@ -576,8 +576,8 @@ func (m *Miner) mineOne(ctx context.Context, base *MiningBase) (minedBlock *type
parentMiners[i] = header.Miner
}
log.Infow("mined new block", "cid", minedBlock.Cid(), "height", int64(minedBlock.Header.Height), "miner", minedBlock.Header.Miner, "parents", parentMiners, "parentTipset", base.TipSet.Key().String(), "took", dur)
if dur > time.Second*time.Duration(build.BlockDelaySecs) {
log.Warnw("CAUTION: block production took longer than the block delay. Your computer may not be fast enough to keep up",
if dur > time.Second*time.Duration(build.BlockDelaySecs) || time.Now().Compare(time.Unix(int64(minedBlock.Header.Timestamp), 0)) >= 0 {
log.Warnw("CAUTION: block production took us past the block time. Your computer may not be fast enough to keep up",
"tPowercheck ", tPowercheck.Sub(tStart),
"tTicket ", tTicket.Sub(tPowercheck),
"tSeed ", tSeed.Sub(tTicket),