fix load genesis (#834)

* fix `SetupGenesisBlockWithOverride`

* fix `configOrDefault`
This commit is contained in:
HAOYUatHZ 2024-06-19 20:50:39 +08:00 committed by GitHub
parent e54781ea02
commit 0144095e64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -316,7 +316,8 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen
// overwrite triedb IsUsingZktrie config to be safe // overwrite triedb IsUsingZktrie config to be safe
triedb.SetIsUsingZktrie(storedcfg.Scroll.ZktrieEnabled()) triedb.SetIsUsingZktrie(storedcfg.Scroll.ZktrieEnabled())
} }
if header.Root != types.EmptyRootHash && !triedb.Initialized(header.Root) { // if header.Root != types.EmptyRootHash && !triedb.Initialized(header.Hash()) {
if _, err := state.New(header.Root, state.NewDatabaseWithNodeDB(db, triedb), nil); err != nil {
if genesis == nil { if genesis == nil {
genesis = DefaultGenesisBlock() genesis = DefaultGenesisBlock()
} }
@ -420,6 +421,12 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig {
return params.SepoliaChainConfig return params.SepoliaChainConfig
case ghash == params.GoerliGenesisHash: case ghash == params.GoerliGenesisHash:
return params.GoerliChainConfig return params.GoerliChainConfig
case ghash == params.ScrollAlphaGenesisHash:
return params.ScrollAlphaChainConfig
case ghash == params.ScrollSepoliaGenesisHash:
return params.ScrollSepoliaChainConfig
case ghash == params.ScrollMainnetGenesisHash:
return params.ScrollMainnetChainConfig
default: default:
return params.AllEthashProtocolChanges return params.AllEthashProtocolChanges
} }