mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 01:27:38 +00:00
parent
6b826174c1
commit
60e8a31fe3
@ -48,6 +48,8 @@ import (
|
||||
//go:embed allocs
|
||||
var allocs embed.FS
|
||||
|
||||
var UseMDBX = true
|
||||
|
||||
var ErrGenesisNoConfig = errors.New("genesis has no chain configuration")
|
||||
|
||||
// Genesis specifies the header fields, state of a genesis block. It also defines hard
|
||||
@ -262,7 +264,12 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig {
|
||||
// ToBlock creates the genesis block and writes state of a genesis specification
|
||||
// to the given database (or discards it if nil).
|
||||
func (g *Genesis) ToBlock() (*types.Block, *state.IntraBlockState, error) {
|
||||
tmpDB := ethdb.NewLMDB().InMem().MustOpen()
|
||||
var tmpDB ethdb.RwKV
|
||||
if UseMDBX {
|
||||
tmpDB = ethdb.NewMDBX().InMem().MustOpen()
|
||||
} else {
|
||||
tmpDB = ethdb.NewLMDB().InMem().MustOpen()
|
||||
}
|
||||
defer tmpDB.Close()
|
||||
tx, err := tmpDB.BeginRw(context.Background())
|
||||
if err != nil {
|
||||
|
@ -309,8 +309,9 @@ func (db *MdbxKV) Close() {
|
||||
if err := os.RemoveAll(db.opts.path); err != nil {
|
||||
db.log.Warn("failed to remove in-mem db file", "err", err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
db.log.Info("database closed (MDBX)")
|
||||
}
|
||||
}
|
||||
|
||||
func (db *MdbxKV) CollectMetrics() {
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/ledgerwatch/erigon/cmd/utils"
|
||||
"github.com/ledgerwatch/erigon/common/dbutils"
|
||||
"github.com/ledgerwatch/erigon/core"
|
||||
"github.com/ledgerwatch/erigon/eth"
|
||||
"github.com/ledgerwatch/erigon/eth/ethconfig"
|
||||
"github.com/ledgerwatch/erigon/eth/stagedsync"
|
||||
@ -78,6 +79,7 @@ func New(
|
||||
|
||||
node := makeConfigNode(nodeConfig)
|
||||
enode.UseMDBX = nodeConfig.MDBX
|
||||
core.UseMDBX = nodeConfig.MDBX
|
||||
ethConfig := makeEthConfig(ctx, node)
|
||||
|
||||
ethConfig.StagedSync = sync
|
||||
|
Loading…
Reference in New Issue
Block a user