Skip to content

Commit 43108bd

Browse files
authored
Merge pull request #2424 from CortexFoundation/dev
log print
2 parents c6c2fe7 + 8217b0e commit 43108bd

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

core/blockchain_insert.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,17 @@ func (st *insertStats) report(chain []*types.Block, index int, dirty common.Stor
6565
context := []any{
6666
"number", end.Number(), "hash", end.Hash(),
6767
"blocks", st.processed, "txs", txs, "mgas", float64(st.usedGas) / 1000000,
68-
"elapsed", common.PrettyDuration(elapsed), "mgasps", float64(st.usedGas) * 1000 / float64(elapsed),
68+
"elapsed", common.PrettyDuration(elapsed),
69+
//"mgasps", float64(st.usedGas) * 1000 / float64(elapsed),
6970
"hps", common.HashSize(float64(end.Difficulty().Int64()) / 13.5),
7071
"mgasps", mgasps, "size", common.StorageSize(size),
7172
}
72-
timestamp := time.Unix(int64(end.Time()), 0)
73-
context = append(context, []any{"age", common.PrettyAge(timestamp)}...)
74-
context = append(context, []any{"dirty", dirty}...)
73+
if timestamp := time.Unix(int64(end.Time()), 0); time.Since(timestamp) > time.Minute {
74+
context = append(context, []interface{}{"age", common.PrettyAge(timestamp)}...)
75+
}
76+
if dirty != 0 { // snapshots enabled
77+
context = append(context, []interface{}{"dirty", dirty}...)
78+
}
7579

7680
if st.queued > 0 {
7781
context = append(context, []any{"queued", st.queued}...)

0 commit comments

Comments
 (0)