erigon-pulse/consensus/db/db.go

19 lines
365 B
Go
Raw Normal View History

package db
import (
2021-07-29 11:53:13 +00:00
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon-lib/kv/mdbx"
2021-07-29 10:23:23 +00:00
"github.com/ledgerwatch/log/v3"
)
func OpenDatabase(path string, logger log.Logger, inmem bool) kv.RwDB {
2022-01-22 05:53:25 +00:00
opts := mdbx.NewMDBX(logger).Label(kv.ConsensusDB)
if inmem {
opts = opts.InMem()
} else {
opts = opts.Path(path)
}
return opts.MustOpen()
}