optimism: minor goerli fixes - banner, clique config, networkid (#36)

This commit is contained in:
protolambda 2023-01-17 18:00:55 +01:00
parent e2e6188144
commit 8ba567f82b
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
3 changed files with 11 additions and 3 deletions

View File

@ -64,6 +64,9 @@ func ReadChainConfig(db ethdb.KeyValueReader, hash common.Hash) *params.ChainCon
log.Error("Invalid chain config JSON", "hash", hash, "err", err)
return nil
}
if config.Optimism != nil {
config.Clique = nil // get rid of legacy clique data in chain config (optimism goerli issue)
}
return &config
}

View File

@ -170,7 +170,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
if bcVersion != nil {
dbVer = fmt.Sprintf("%d", *bcVersion)
}
log.Info("Initialising Ethereum protocol", "network", config.NetworkId, "dbversion", dbVer)
if !config.SkipBcVersionCheck {
if bcVersion != nil && *bcVersion > core.BlockChainVersion {
@ -213,6 +212,12 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
if err != nil {
return nil, err
}
if chainConfig := eth.blockchain.Config(); chainConfig.Optimism != nil { // config.Genesis.Config.ChainID cannot be used because it's based on CLI flags only, thus default to mainnet L1
config.NetworkId = chainConfig.ChainID.Uint64() // optimism defaults eth network ID to chain ID
eth.networkID = config.NetworkId
}
log.Info("Initialising Ethereum protocol", "network", config.NetworkId, "dbversion", dbVer)
eth.bloomIndexer.Start(eth.blockchain)
if config.TxPool.Journal != "" {

View File

@ -506,6 +506,8 @@ func (c *ChainConfig) Description() string {
}
banner += fmt.Sprintf("Chain ID: %v (%s)\n", c.ChainID, network)
switch {
case c.Optimism != nil:
banner += "Consensus: Optimism\n"
case c.Ethash != nil:
if c.TerminalTotalDifficulty == nil {
banner += "Consensus: Ethash (proof-of-work)\n"
@ -522,8 +524,6 @@ func (c *ChainConfig) Description() string {
} else {
banner += "Consensus: Beacon (proof-of-stake), merged from Clique (proof-of-authority)\n"
}
case c.Optimism != nil:
banner += "Consensus: Optimism\n"
default:
banner += "Consensus: unknown\n"
}