diff --git a/cmd/pics/state.go b/cmd/pics/state.go index ae862fac0..082ef307f 100644 --- a/cmd/pics/state.go +++ b/cmd/pics/state.go @@ -301,7 +301,7 @@ func initialState1() error { return err } t := tds.Trie() - snapshotDb := db.MemCopy().DB() + snapshotDb := db.MemCopy().(*ethdb.BoltDatabase).DB() var codeMap map[common.Hash][]byte if codeMap, err = constructCodeMap(tds); err != nil { return err @@ -425,7 +425,7 @@ func initialState1() error { }) // BLOCK 1 - snapshotDb = db.MemCopy().DB() + snapshotDb = db.MemCopy().(*ethdb.BoltDatabase).DB() if _, err = blockchain.InsertChain(types.Blocks{blocks[0]}); err != nil { return err @@ -441,7 +441,7 @@ func initialState1() error { } // BLOCK 2 - snapshotDb = db.MemCopy().DB() + snapshotDb = db.MemCopy().(*ethdb.BoltDatabase).DB() if _, err = blockchain.InsertChain(types.Blocks{blocks[1]}); err != nil { return err @@ -457,7 +457,7 @@ func initialState1() error { } // BLOCK 3 - snapshotDb = db.MemCopy().DB() + snapshotDb = db.MemCopy().(*ethdb.BoltDatabase).DB() if _, err = blockchain.InsertChain(types.Blocks{blocks[2]}); err != nil { return err @@ -479,7 +479,7 @@ func initialState1() error { } // BLOCK 4 - snapshotDb = db.MemCopy().DB() + snapshotDb = db.MemCopy().(*ethdb.BoltDatabase).DB() if _, err = blockchain.InsertChain(types.Blocks{blocks[3]}); err != nil { return err @@ -495,7 +495,7 @@ func initialState1() error { } // BLOCK 5 - snapshotDb = db.MemCopy().DB() + snapshotDb = db.MemCopy().(*ethdb.BoltDatabase).DB() if _, err = blockchain.InsertChain(types.Blocks{blocks[4]}); err != nil { return err @@ -511,7 +511,7 @@ func initialState1() error { } // BLOCK 6 - snapshotDb = db.MemCopy().DB() + snapshotDb = db.MemCopy().(*ethdb.BoltDatabase).DB() if _, err = blockchain.InsertChain(types.Blocks{blocks[5]}); err != nil { return err @@ -530,7 +530,7 @@ func initialState1() error { } // BLOCK 7 - snapshotDb = db.MemCopy().DB() + snapshotDb = db.MemCopy().(*ethdb.BoltDatabase).DB() if _, err = blockchain.InsertChain(types.Blocks{blocks[6]}); err != nil { return err @@ -548,7 +548,7 @@ func initialState1() error { tds.SetResolveReads(true) // BLOCK 8 - snapshotDb = db.MemCopy().DB() + snapshotDb = db.MemCopy().(*ethdb.BoltDatabase).DB() if _, err = blockchain.InsertChain(types.Blocks{blocks[7]}); err != nil { return err diff --git a/ethdb/interface.go b/ethdb/interface.go index 9d13fa475..92356643e 100644 --- a/ethdb/interface.go +++ b/ethdb/interface.go @@ -18,8 +18,6 @@ package ethdb import ( "errors" - - "github.com/ledgerwatch/bolt" ) // ErrKeyNotFound is returned when key isn't found in the database. @@ -81,8 +79,6 @@ type Database interface { Size() int Keys() ([][]byte, error) MemCopy() Database - // TODO [Andrew] don't expose Bolt DB - DB() *bolt.DB // [TURBO-GETH] Freezer support (minimum amount that is actually used) // FIXME: implement support if needed Ancients() (uint64, error) diff --git a/ethdb/mutation.go b/ethdb/mutation.go index a42e886c2..07d3412cb 100644 --- a/ethdb/mutation.go +++ b/ethdb/mutation.go @@ -3,12 +3,12 @@ package ethdb import ( "bytes" "errors" - "github.com/ledgerwatch/bolt" + "sync" + "github.com/ledgerwatch/turbo-geth/common" "github.com/ledgerwatch/turbo-geth/common/dbutils" "github.com/ledgerwatch/turbo-geth/log" "github.com/petar/GoLLRB/llrb" - "sync" ) type PutItem struct { @@ -460,8 +460,3 @@ func (m *mutation) Ancients() (uint64, error) { func (m *mutation) TruncateAncients(items uint64) error { return errNotSupported } - -// Get bolt database instance -func (m *mutation) DB() *bolt.DB { - return m.db.DB() -}