erigon-pulse/consensus/db/db.go
Evgeny Danilenko 17c07c50a5
Move clique buckets to separate DB (#1703)
* debug

* debug

* it works

* rename clique bucket

* remove genesis special case

* copy snapshot

* remove debug

* migration

* debug

* regenerate snapshots

* simplify

* regeneration

* after merge

* tests

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2021-04-19 22:58:05 +01:00

32 lines
536 B
Go

package db
import (
"github.com/ledgerwatch/turbo-geth/ethdb"
)
func OpenDatabase(path string, inmem bool, mdbx bool) *ethdb.ObjectDatabase {
return ethdb.NewObjectDatabase(openKV(path, inmem, mdbx))
}
func openKV(path string, inmem bool, mdbx bool) ethdb.RwKV {
if mdbx {
opts := ethdb.NewMDBX()
if inmem {
opts = opts.InMem()
} else {
opts = opts.Path(path)
}
return opts.MustOpen()
}
opts := ethdb.NewLMDB()
if inmem {
opts = opts.InMem()
} else {
opts = opts.Path(path)
}
return opts.MustOpen()
}