diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-06-23 15:12:41 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-06-23 15:12:41 +0800 |
commit | d40179f882f00e8c8c992ebc5b0bed937090e90c (patch) | |
tree | 1742febd8f968897869237bb95a59904597b0d9a /eth | |
parent | b664bedcf21f30b54af542e0b4ba4e24c01968fd (diff) | |
download | dexon-d40179f882f00e8c8c992ebc5b0bed937090e90c.tar.gz dexon-d40179f882f00e8c8c992ebc5b0bed937090e90c.tar.zst dexon-d40179f882f00e8c8c992ebc5b0bed937090e90c.zip |
eth: gracefully error if database cannot be opened
Diffstat (limited to 'eth')
-rw-r--r-- | eth/backend.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/eth/backend.go b/eth/backend.go index be2d03283..75e0e737b 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -200,10 +200,13 @@ func makeExtraData(extra []byte) []byte { // CreateDB creates the chain database. func CreateDB(ctx *node.ServiceContext, config *Config, name string) (ethdb.Database, error) { db, err := ctx.OpenDatabase(name, config.DatabaseCache, config.DatabaseHandles) + if err != nil { + return nil, err + } if db, ok := db.(*ethdb.LDBDatabase); ok { db.Meter("eth/db/chaindata/") } - return db, err + return db, nil } // CreateConsensusEngine creates the required type of consensus engine instance for an Ethereum service |