erigon-pulse/consensus/db/db.go
2021-07-29 18:53:13 +07:00

19 lines
343 B
Go

package db
import (
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon-lib/kv/mdbx"
"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()
}