incremental commit, manual changes to support merge

This commit is contained in:
philip-morlier
2023-07-11 17:01:10 -07:00
parent e516d5842c
commit dc56f2a361
5 changed files with 30 additions and 53 deletions
+17
View File
@@ -186,3 +186,20 @@ func CreateConsensusEngine(config *params.ChainConfig, db ethdb.Database) (conse
}
return beacon.New(ethash.NewFaker()), nil
}
// CreateConsensusEngine creates a consensus engine for the given chain config.
// Clique is allowed for now to live standalone, but ethash is forbidden and can
// only exist on already merged networks.
func CreateConsensusEngine(config *params.ChainConfig, db ethdb.Database) (consensus.Engine, error) {
// If proof-of-authority is requested, set it up
if config.Clique != nil {
return beacon.New(clique.New(config.Clique, db)), nil
}
// If defaulting to proof-of-work, enforce an already merged network since
// we cannot run PoW algorithms and more, so we cannot even follow a chain
// not coordinated by a beacon node.
if !config.TerminalTotalDifficultyPassed {
return nil, errors.New("ethash is only supported as a historical component of already merged networks")
}
return beacon.New(ethash.NewFaker()), nil
}