logs: add some logs to trace block miner, justified reorg; (#1894)

This commit is contained in:
GalaIO 2023-09-25 20:11:52 +08:00 committed by lx
parent b3ef585957
commit d179056512
2 changed files with 5 additions and 1 deletions

@ -56,7 +56,7 @@ func (st *insertStats) report(chain []*types.Block, index int, dirty common.Stor
// Assemble the log context and send it to the logger // Assemble the log context and send it to the logger
context := []interface{}{ context := []interface{}{
"number", end.Number(), "hash", end.Hash(), "number", end.Number(), "hash", end.Hash(), "miner", end.Coinbase(),
"blocks", st.processed, "txs", txs, "mgas", float64(st.usedGas) / 1000000, "blocks", st.processed, "txs", txs, "mgas", float64(st.usedGas) / 1000000,
"elapsed", common.PrettyDuration(elapsed), "mgasps", float64(st.usedGas) * 1000 / float64(elapsed), "elapsed", common.PrettyDuration(elapsed), "mgasps", float64(st.usedGas) * 1000 / float64(elapsed),
} }

@ -137,5 +137,9 @@ func (f *ForkChoice) ReorgNeededWithFastFinality(current *types.Header, header *
return f.ReorgNeeded(current, header) return f.ReorgNeeded(current, header)
} }
if justifiedNumber > curJustifiedNumber && header.Number.Cmp(current.Number) <= 0 {
log.Info("Chain find higher justifiedNumber", "fromHeight", current.Number, "fromHash", current.Hash(), "fromMiner", current.Coinbase, "fromJustified", curJustifiedNumber,
"toHeight", header.Number, "toHash", header.Hash(), "toMiner", header.Coinbase, "toJustified", justifiedNumber)
}
return justifiedNumber > curJustifiedNumber, nil return justifiedNumber > curJustifiedNumber, nil
} }