good morning!!!!

Skip to content
Snippets Groups Projects
Commit 4f4175a3 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

Addad db name for new ldb

parent c7e73ba1
No related branches found
No related tags found
No related merge requests found
...@@ -11,8 +11,8 @@ type LDBDatabase struct { ...@@ -11,8 +11,8 @@ type LDBDatabase struct {
db *leveldb.DB db *leveldb.DB
} }
func NewLDBDatabase() (*LDBDatabase, error) { func NewLDBDatabase(name string) (*LDBDatabase, error) {
dbPath := path.Join(ethutil.Config.ExecPath, "database") dbPath := path.Join(ethutil.Config.ExecPath, name)
// Open the db // Open the db
db, err := leveldb.OpenFile(dbPath, nil) db, err := leveldb.OpenFile(dbPath, nil)
...@@ -40,6 +40,10 @@ func (db *LDBDatabase) Delete(key []byte) error { ...@@ -40,6 +40,10 @@ func (db *LDBDatabase) Delete(key []byte) error {
return db.db.Delete(key, nil) return db.db.Delete(key, nil)
} }
func (db *LDBDatabase) Db() *leveldb.DB {
return db.db
}
func (db *LDBDatabase) LastKnownTD() []byte { func (db *LDBDatabase) LastKnownTD() []byte {
data, _ := db.db.Get([]byte("LastKnownTotalDifficulty"), nil) data, _ := db.db.Get([]byte("LastKnownTotalDifficulty"), nil)
......
...@@ -61,7 +61,7 @@ type Ethereum struct { ...@@ -61,7 +61,7 @@ type Ethereum struct {
} }
func New(caps Caps, usePnp bool) (*Ethereum, error) { func New(caps Caps, usePnp bool) (*Ethereum, error) {
db, err := ethdb.NewLDBDatabase() db, err := ethdb.NewLDBDatabase("database")
//db, err := ethdb.NewMemDatabase() //db, err := ethdb.NewMemDatabase()
if err != nil { if err != nil {
return nil, err return nil, err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment