Skip to content

Commit ac17319

Browse files
authored
triedb/pathdb: improve err message in historical state reader (#32477)
Fixes #32474
1 parent 10421ed commit ac17319

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

triedb/pathdb/reader.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ type HistoricalStateReader struct {
207207
// HistoricReader constructs a reader for accessing the requested historic state.
208208
func (db *Database) HistoricReader(root common.Hash) (*HistoricalStateReader, error) {
209209
// Bail out if the state history hasn't been fully indexed
210-
if db.indexer == nil || !db.indexer.inited() {
211-
return nil, errors.New("state histories haven't been fully indexed yet")
210+
if db.indexer == nil || db.freezer == nil {
211+
return nil, fmt.Errorf("historical state %x is not available", root)
212212
}
213-
if db.freezer == nil {
214-
return nil, errors.New("state histories are not available")
213+
if !db.indexer.inited() {
214+
return nil, errors.New("state histories haven't been fully indexed yet")
215215
}
216216
// States at the current disk layer or above are directly accessible via
217217
// db.StateReader.

0 commit comments

Comments
 (0)