Skip to content

Commit d135baf

Browse files
authored
cmd/geth: print progress logs when iterating large contracts too (#28179)
1 parent 83f3fc2 commit d135baf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmd/geth/snapshot.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,11 @@ func traverseState(ctx *cli.Context) error {
332332
storageIter := trie.NewIterator(storageIt)
333333
for storageIter.Next() {
334334
slots += 1
335+
336+
if time.Since(lastReport) > time.Second*8 {
337+
log.Info("Traversing state", "accounts", accounts, "slots", slots, "codes", codes, "elapsed", common.PrettyDuration(time.Since(start)))
338+
lastReport = time.Now()
339+
}
335340
}
336341
if storageIter.Err != nil {
337342
log.Error("Failed to traverse storage trie", "root", acc.Root, "err", storageIter.Err)
@@ -486,6 +491,10 @@ func traverseRawState(ctx *cli.Context) error {
486491
if storageIter.Leaf() {
487492
slots += 1
488493
}
494+
if time.Since(lastReport) > time.Second*8 {
495+
log.Info("Traversing state", "nodes", nodes, "accounts", accounts, "slots", slots, "codes", codes, "elapsed", common.PrettyDuration(time.Since(start)))
496+
lastReport = time.Now()
497+
}
489498
}
490499
if storageIter.Error() != nil {
491500
log.Error("Failed to traverse storage trie", "root", acc.Root, "err", storageIter.Error())

0 commit comments

Comments
 (0)