Merge pull request #11228 from filecoin-project/asr/log-slow-block

feat: miner: log detailed timing breakdown when mining takes longer than the block's timestamp
This commit is contained in:
Aayush Rajasekaran 2023-09-05 12:07:28 -04:00 committed by GitHub
commit 9567dee00c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -637,8 +637,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),