mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-23 04:03:49 +00:00
Don't expose Bolt DB in the interface
This commit is contained in:
parent
4a9faff349
commit
6352fc024c
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user