triedb/pathdb: rename

This commit is contained in:
Gary Rong 2024-02-28 20:29:58 +08:00
parent ee7cf56323
commit 98fcaa31db

View file

@ -377,10 +377,10 @@ func (db *Database) Recover(root common.Hash, loader triestate.TrieLoader) error
} }
// Recoverable returns the indicator if the specified state is recoverable. // Recoverable returns the indicator if the specified state is recoverable.
func (db *Database) Recoverable(target common.Hash) bool { func (db *Database) Recoverable(root common.Hash) bool {
// Ensure the requested state is a known state. // Ensure the requested state is a known state.
target = types.TrieRootHash(target) root = types.TrieRootHash(root)
id := rawdb.ReadStateID(db.diskdb, target) id := rawdb.ReadStateID(db.diskdb, root)
if id == nil { if id == nil {
return false return false
} }
@ -401,13 +401,13 @@ func (db *Database) Recoverable(target common.Hash) bool {
// Ensure the requested state is a canonical state and all state // Ensure the requested state is a canonical state and all state
// histories in range [id+1, disklayer.ID] are present and complete. // histories in range [id+1, disklayer.ID] are present and complete.
return checkHistories(db.freezer, *id+1, dl.stateID()-*id, func(m *meta) error { return checkHistories(db.freezer, *id+1, dl.stateID()-*id, func(m *meta) error {
if m.parent != target { if m.parent != root {
return errors.New("unexpected state history") return errors.New("unexpected state history")
} }
if len(m.incomplete) > 0 { if len(m.incomplete) > 0 {
return errors.New("incomplete state history") return errors.New("incomplete state history")
} }
target = m.root root = m.root
return nil return nil
}) == nil }) == nil
} }