Skip to content

Commit 123d4ee

Browse files
committed
Check that datadir exists
1 parent 34986c1 commit 123d4ee

File tree

1 file changed

+5
-0
lines changed
  • op-chain-ops/cmd/celo-migrate

1 file changed

+5
-0
lines changed

op-chain-ops/cmd/celo-migrate/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"math/big"
78
"os"
@@ -421,6 +422,10 @@ func ApplyMigrationChangesToDB(ldb ethdb.Database, genesis *core.Genesis, commit
421422
}
422423

423424
func Open(path string, cache int, handles int) (ethdb.Database, error) {
425+
if _, err := os.Stat(path); errors.Is(err, os.ErrNotExist) {
426+
return nil, err
427+
}
428+
424429
chaindataPath := filepath.Join(path, "celo", "chaindata")
425430
ancientPath := filepath.Join(chaindataPath, "ancient")
426431
ldb, err := rawdb.Open(rawdb.OpenOptions{

0 commit comments

Comments
 (0)