core/genesis.go¶
| Type | MOD |
| Upstream Lines | 759 |
| Changed | +7 -1 |
Rename IsLondon→IsEIP1559 in the BaseFee gate and write the genesis TD to the database
diff --git a/core/genesis.go b/core/genesis.go
index 6a0affa52..df9b97280 100644
--- a/core/genesis.go
+++ b/core/genesis.go
@@ -457,6 +457,11 @@ func (g *Genesis) chainConfigOrDefault(ghash common.Hash, stored *params.ChainCo
switch {
case g != nil:
return g.Config
+ // ETC shares ETH mainnet's genesis hash, so the hash-based cases below would
+ // misresolve a Classic datadir to mainnet. A stored Classic/Mordor config must win
+ // (IsClassic lives in params/config_etc.go).
+ case stored != nil && stored.IsClassic():
+ return stored
case ghash == params.MainnetGenesisHash:
return params.MainnetChainConfig
case ghash == params.HoleskyGenesisHash:
@@ -511,7 +516,7 @@ func (g *Genesis) toBlockWithRoot(root common.Hash) *types.Block {
head.Difficulty = params.GenesisDifficulty
}
}
- if g.Config != nil && g.Config.IsLondon(common.Big0) {
+ if g.Config != nil && g.Config.IsEIP1559(common.Big0) {
if g.BaseFee != nil {
head.BaseFee = g.BaseFee
} else {
@@ -590,6 +595,7 @@ func (g *Genesis) Commit(db ethdb.Database, triedb *triedb.Database, tracer *tra
}
batch := db.NewBatch()
rawdb.WriteGenesisStateSpec(batch, block.Hash(), blob)
+ rawdb.WriteTd(batch, block.Hash(), block.NumberU64(), block.Difficulty())
rawdb.WriteBlock(batch, block)
rawdb.WriteReceipts(batch, block.Hash(), block.NumberU64(), nil)
rawdb.WriteCanonicalHash(batch, block.Hash(), block.NumberU64())