From d135bafdcb1d023c3ef74d11f3b8d4ebd06f253c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 22 Sep 2023 11:07:20 +0300 Subject: [PATCH] cmd/geth: print progress logs when iterating large contracts too (#28179) --- cmd/geth/snapshot.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/geth/snapshot.go b/cmd/geth/snapshot.go index 5e1c784730..b1db0c9d5a 100644 --- a/cmd/geth/snapshot.go +++ b/cmd/geth/snapshot.go @@ -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) @@ -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())