Skip to content

Commit

Permalink
cmd/geth: print progress logs when iterating large contracts too (eth…
Browse files Browse the repository at this point in the history
  • Loading branch information
karalabe authored and siosw committed Oct 16, 2023
1 parent 9b54c60 commit b02e4b1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/geth/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ func traverseState(ctx *cli.Context) error {
storageIter := trie.NewIterator(storageIt)
for storageIter.Next() {
slots += 1

if time.Since(lastReport) > time.Second*8 {
log.Info("Traversing state", "accounts", accounts, "slots", slots, "codes", codes, "elapsed", common.PrettyDuration(time.Since(start)))
lastReport = time.Now()
}
}
if storageIter.Err != nil {
log.Error("Failed to traverse storage trie", "root", acc.Root, "err", storageIter.Err)
Expand Down Expand Up @@ -486,6 +491,10 @@ func traverseRawState(ctx *cli.Context) error {
if storageIter.Leaf() {
slots += 1
}
if time.Since(lastReport) > time.Second*8 {
log.Info("Traversing state", "nodes", nodes, "accounts", accounts, "slots", slots, "codes", codes, "elapsed", common.PrettyDuration(time.Since(start)))
lastReport = time.Now()
}
}
if storageIter.Error() != nil {
log.Error("Failed to traverse storage trie", "root", acc.Root, "err", storageIter.Error())
Expand Down

0 comments on commit b02e4b1

Please sign in to comment.