erigon22: bsc fixes

This commit is contained in:
Alex Sharov 2022-08-13 16:09:52 +07:00 committed by GitHub
parent 4f007ae43e
commit de3a602a24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 17 deletions

View File

@ -1251,6 +1251,8 @@ func initConsensusEngine(chainConfig *params.ChainConfig, logger log.Logger, sna
consensusConfig := &params.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 := &params.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:

View File

@ -634,6 +634,8 @@ func initConsensusEngine(chainConfig *params.ChainConfig, logger log.Logger, sna
consensusConfig := &params.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 := &params.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
}

View File

@ -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)

View File

@ -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)