Skip to content

Commit

Permalink
optimism: minor goerli fixes - banner, clique config, networkid (bnb-…
Browse files Browse the repository at this point in the history
  • Loading branch information
protolambda committed Feb 22, 2023
1 parent e2e6188 commit 8ba567f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions core/rawdb/accessors_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
7 changes: 6 additions & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 != "" {
Expand Down
4 changes: 2 additions & 2 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
}
Expand Down

0 comments on commit 8ba567f

Please sign in to comment.