From c053afb14edd0434fca84f39be8697fe3113f1c2 Mon Sep 17 00:00:00 2001 From: VM Date: Mon, 18 Nov 2024 11:16:06 +0800 Subject: [PATCH] fix: optimize logs --- triedb/pathdb/database_test.go | 2 -- triedb/pathdb/journal.go | 7 ++----- triedb/pathdb/nodebufferlist.go | 1 - 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/triedb/pathdb/database_test.go b/triedb/pathdb/database_test.go index 3674064cf..c823f0529 100644 --- a/triedb/pathdb/database_test.go +++ b/triedb/pathdb/database_test.go @@ -319,7 +319,6 @@ func (t *tester) verifyState(root common.Hash) error { } _, err = reader.Node(common.Hash{}, nil, root) if err != nil { - fmt.Println("error: ", err) return errors.New("root node is not available") } for addrHash, account := range t.snapAccounts[root] { @@ -460,7 +459,6 @@ func TestDisable(t *testing.T) { t.Fatalf("Invalid activation should be rejected") } if err := tester.db.Enable(stored); err != nil { - fmt.Println(err) t.Fatal("Failed to activate database") } diff --git a/triedb/pathdb/journal.go b/triedb/pathdb/journal.go index 4579bb41a..13e73bbaf 100644 --- a/triedb/pathdb/journal.go +++ b/triedb/pathdb/journal.go @@ -250,7 +250,6 @@ func (db *Database) loadLayers() layer { _, root := rawdb.ReadAccountTrieNode(db.diskdb, nil) root = types.TrieRootHash(root) - fmt.Println("1 useBase, fastRecovery", db.useBase, db.fastRecovery) // Load the layers by resolving the journal head, err := db.loadJournal(root) if err == nil { @@ -269,7 +268,6 @@ func (db *Database) loadLayers() layer { stateID = rawdb.ReadPersistentStateID(db.diskdb) ) - fmt.Println("2 useBase, fastRecovery", db.useBase, db.fastRecovery) if (errors.Is(err, errMissJournal) || errors.Is(err, errUnmatchedJournal)) && db.fastRecovery && db.config.TrieNodeBufferType == NodeBufferList && !db.useBase { start := time.Now() @@ -362,7 +360,6 @@ func (db *Database) loadDiskLayer(r *rlp.Stream, journalTypeForReader JournalTyp } } - fmt.Println("3 useBase, fastRecovery", db.useBase, db.fastRecovery) // Calculate the internal state transitions by id difference. nb, err := NewTrieNodeBuffer(db.diskdb, db.config.TrieNodeBufferType, db.bufferSize, nodes, id-stored, db.config.ProposeBlockInterval, db.config.NotifyKeep, db.freezer, db.fastRecovery, db.useBase) @@ -374,11 +371,11 @@ func (db *Database) loadDiskLayer(r *rlp.Stream, journalTypeForReader JournalTyp if db.config.TrieNodeBufferType == NodeBufferList && !db.useBase { recoveredRoot, recoveredStateID, _ := nb.getLatestStatus() if recoveredRoot != root && recoveredStateID != id { - log.Error("unequal state root and state id") + log.Error("Recovering state root and state id are different from recording ones") return nil, errors.New("Unmatched root and state id with recovered") } - log.Info("Finish recovering node buffer list", "latest root hash", recoveredRoot.String(), + log.Info("Disk layer finishes recovering node buffer list", "latest root hash", recoveredRoot.String(), "latest state_id", recoveredStateID) } diff --git a/triedb/pathdb/nodebufferlist.go b/triedb/pathdb/nodebufferlist.go index d1b43d70e..ecd2359b0 100644 --- a/triedb/pathdb/nodebufferlist.go +++ b/triedb/pathdb/nodebufferlist.go @@ -123,7 +123,6 @@ func newNodeBufferList( keepFunc: keepFunc, } - fmt.Println("useBase, fastRecovery", useBase, fastRecovery) if !useBase && fastRecovery { if freezer == nil { log.Crit("Use unopened freezer db to recover node buffer list")