Skip to content

Commit d40179f

Browse files
committed
eth: gracefully error if database cannot be opened
1 parent b664bed commit d40179f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

eth/backend.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,13 @@ func makeExtraData(extra []byte) []byte {
200200
// CreateDB creates the chain database.
201201
func CreateDB(ctx *node.ServiceContext, config *Config, name string) (ethdb.Database, error) {
202202
db, err := ctx.OpenDatabase(name, config.DatabaseCache, config.DatabaseHandles)
203+
if err != nil {
204+
return nil, err
205+
}
203206
if db, ok := db.(*ethdb.LDBDatabase); ok {
204207
db.Meter("eth/db/chaindata/")
205208
}
206-
return db, err
209+
return db, nil
207210
}
208211

209212
// CreateConsensusEngine creates the required type of consensus engine instance for an Ethereum service

0 commit comments

Comments
 (0)