Skip to content

Commit

Permalink
fix: fix state inspect error after pruned state
Browse files Browse the repository at this point in the history
  • Loading branch information
flywukong committed Jul 2, 2024
1 parent f1a85ec commit 60149eb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/rawdb/ancient_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package rawdb

import (
"fmt"
"io"
"os"
"path/filepath"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -98,6 +100,18 @@ func inspectFreezers(db ethdb.Database) ([]freezerInfo, error) {
if err != nil {
return nil, err
}

file, err := os.Open(filepath.Join(datadir, StateFreezerName))
if err != nil {
return nil, err
}
defer file.Close()
// if state freezer folder has been pruned, there is no need for inspection
_, err = file.Readdirnames(1)
if err == io.EOF {
continue
}

f, err := NewStateFreezer(datadir, true, 0)
if err != nil {
return nil, err
Expand Down

0 comments on commit 60149eb

Please sign in to comment.