aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ethdb/database.go8
-rw-r--r--ethereum.go2
2 files changed, 7 insertions, 3 deletions
diff --git a/ethdb/database.go b/ethdb/database.go
index 1e987920d..d1967f023 100644
--- a/ethdb/database.go
+++ b/ethdb/database.go
@@ -11,8 +11,8 @@ type LDBDatabase struct {
db *leveldb.DB
}
-func NewLDBDatabase() (*LDBDatabase, error) {
- dbPath := path.Join(ethutil.Config.ExecPath, "database")
+func NewLDBDatabase(name string) (*LDBDatabase, error) {
+ dbPath := path.Join(ethutil.Config.ExecPath, name)
// Open the db
db, err := leveldb.OpenFile(dbPath, nil)
@@ -40,6 +40,10 @@ func (db *LDBDatabase) Delete(key []byte) error {
return db.db.Delete(key, nil)
}
+func (db *LDBDatabase) Db() *leveldb.DB {
+ return db.db
+}
+
func (db *LDBDatabase) LastKnownTD() []byte {
data, _ := db.db.Get([]byte("LastKnownTotalDifficulty"), nil)
diff --git a/ethereum.go b/ethereum.go
index 725fe5a3d..90682b396 100644
--- a/ethereum.go
+++ b/ethereum.go
@@ -61,7 +61,7 @@ type Ethereum struct {
}
func New(caps Caps, usePnp bool) (*Ethereum, error) {
- db, err := ethdb.NewLDBDatabase()
+ db, err := ethdb.NewLDBDatabase("database")
//db, err := ethdb.NewMemDatabase()
if err != nil {
return nil, err