aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-06-23 15:12:41 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-06-23 15:12:41 +0800
commitd40179f882f00e8c8c992ebc5b0bed937090e90c (patch)
tree1742febd8f968897869237bb95a59904597b0d9a /eth/backend.go
parentb664bedcf21f30b54af542e0b4ba4e24c01968fd (diff)
downloadgo-tangerine-d40179f882f00e8c8c992ebc5b0bed937090e90c.tar
go-tangerine-d40179f882f00e8c8c992ebc5b0bed937090e90c.tar.gz
go-tangerine-d40179f882f00e8c8c992ebc5b0bed937090e90c.tar.bz2
go-tangerine-d40179f882f00e8c8c992ebc5b0bed937090e90c.tar.lz
go-tangerine-d40179f882f00e8c8c992ebc5b0bed937090e90c.tar.xz
go-tangerine-d40179f882f00e8c8c992ebc5b0bed937090e90c.tar.zst
go-tangerine-d40179f882f00e8c8c992ebc5b0bed937090e90c.zip
eth: gracefully error if database cannot be opened
Diffstat (limited to 'eth/backend.go')
-rw-r--r--eth/backend.go5
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