Skip to content

Commit

Permalink
fix: optimize logs
Browse files Browse the repository at this point in the history
  • Loading branch information
VM committed Nov 18, 2024
1 parent c68b2ae commit c053afb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 0 additions & 2 deletions triedb/pathdb/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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] {
Expand Down Expand Up @@ -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")
}

Expand Down
7 changes: 2 additions & 5 deletions triedb/pathdb/journal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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)
}

Expand Down
1 change: 0 additions & 1 deletion triedb/pathdb/nodebufferlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit c053afb

Please sign in to comment.