diff --git a/cmd/integration/commands/stages.go b/cmd/integration/commands/stages.go index 8f1577c78..8ec7a3107 100644 --- a/cmd/integration/commands/stages.go +++ b/cmd/integration/commands/stages.go @@ -1251,6 +1251,8 @@ func initConsensusEngine(chainConfig *params.ChainConfig, logger log.Logger, sna consensusConfig := ¶ms.AuRaConfig{DBPath: filepath.Join(datadir, "aura")} engine = ethconsensusconfig.CreateConsensusEngine(chainConfig, logger, consensusConfig, config.Miner.Notify, config.Miner.Noverify, "", true, datadir, snapshots, true /* readonly */) case chainConfig.Parlia != nil: + // Apply special hacks for BSC params + params.ApplyBinanceSmartChainParams() consensusConfig := ¶ms.ParliaConfig{DBPath: filepath.Join(datadir, "parlia")} engine = ethconsensusconfig.CreateConsensusEngine(chainConfig, logger, consensusConfig, config.Miner.Notify, config.Miner.Noverify, "", true, datadir, snapshots, true /* readonly */) case chainConfig.Bor != nil: diff --git a/cmd/state/commands/erigon2.go b/cmd/state/commands/erigon2.go index a10e314b7..1427aba3c 100644 --- a/cmd/state/commands/erigon2.go +++ b/cmd/state/commands/erigon2.go @@ -634,6 +634,8 @@ func initConsensusEngine(chainConfig *params.ChainConfig, logger log.Logger, sna consensusConfig := ¶ms.AuRaConfig{DBPath: filepath.Join(datadir, "aura")} engine = ethconsensusconfig.CreateConsensusEngine(chainConfig, logger, consensusConfig, config.Miner.Notify, config.Miner.Noverify, "", true, datadir, snapshots, true /* readonly */) case chainConfig.Parlia != nil: + // Apply special hacks for BSC params + params.ApplyBinanceSmartChainParams() consensusConfig := ¶ms.ParliaConfig{DBPath: filepath.Join(datadir, "parlia")} engine = ethconsensusconfig.CreateConsensusEngine(chainConfig, logger, consensusConfig, config.Miner.Notify, config.Miner.Noverify, "", true, datadir, snapshots, true /* readonly */) case chainConfig.Bor != nil: @@ -642,5 +644,6 @@ func initConsensusEngine(chainConfig *params.ChainConfig, logger log.Logger, sna default: //ethash engine = ethash.NewFaker() } + return } diff --git a/cmd/state/commands/erigon22.go b/cmd/state/commands/erigon22.go index 68c0e9995..354d2f374 100644 --- a/cmd/state/commands/erigon22.go +++ b/cmd/state/commands/erigon22.go @@ -126,8 +126,6 @@ func Erigon22(execCtx context.Context, genesis *core.Genesis, logger log.Logger) defer agg.Close() workerCount := workers - _ = workerCount - execCfg := stagedsync.StageExecuteBlocksCfg(db, cfg.Prune, cfg.BatchSize, nil, chainConfig, engine, &vm.Config{}, nil, /*stateStream=*/ false, /*badBlockHalt=*/ false, dirs, blockReader, nil, genesis, workerCount) diff --git a/eth/backend.go b/eth/backend.go index c7004db0c..8b536761b 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -307,21 +307,6 @@ func New(stack *node.Node, config *ethconfig.Config, logger log.Logger) (*Ethere }() } - var consensusConfig interface{} - - if chainConfig.Clique != nil { - consensusConfig = &config.Clique - } else if chainConfig.Aura != nil { - config.Aura.Etherbase = config.Miner.Etherbase - consensusConfig = &config.Aura - } else if chainConfig.Parlia != nil { - consensusConfig = &config.Parlia - } else if chainConfig.Bor != nil { - consensusConfig = &config.Bor - } else { - consensusConfig = &config.Ethash - } - inMemoryExecution := func(batch kv.RwTx, header *types.Header, body *types.RawBody, unwindPoint uint64, headersChain []*types.Header, bodiesChain []*types.RawBody) error { stateSync, err := stages2.NewInMemoryExecution(backend.sentryCtx, backend.log, backend.chainDB, config, backend.sentriesClient, tmpdir, backend.notifications, allSnapshots) if err != nil { @@ -338,7 +323,22 @@ func New(stack *node.Node, config *ethconfig.Config, logger log.Logger) (*Ethere if currentBlock != nil { currentBlockNumber = currentBlock.NumberU64() } + log.Info("Initialising Ethereum protocol", "network", config.NetworkID) + var consensusConfig interface{} + + if chainConfig.Clique != nil { + consensusConfig = &config.Clique + } else if chainConfig.Aura != nil { + config.Aura.Etherbase = config.Miner.Etherbase + consensusConfig = &config.Aura + } else if chainConfig.Parlia != nil { + consensusConfig = &config.Parlia + } else if chainConfig.Bor != nil { + consensusConfig = &config.Bor + } else { + consensusConfig = &config.Ethash + } backend.engine = ethconsensusconfig.CreateConsensusEngine(chainConfig, logger, consensusConfig, config.Miner.Notify, config.Miner.Noverify, config.HeimdallURL, config.WithoutHeimdall, stack.DataDir(), allSnapshots, false /* readonly */) backend.forkValidator = engineapi.NewForkValidator(currentBlockNumber, inMemoryExecution)