erigon-pulse/consensus/db/db.go

19 lines
343 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 {
opts := mdbx.NewMDBX(logger)
if inmem {
opts = opts.InMem()
} else {
opts = opts.Path(path)
}
return opts.MustOpen()
}