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