core/genesis.go — Version Comparison
|
v1.16.8 |
v1.17.3 |
| Branch |
etc/v1.16.8-full-node |
etc/v1.17.3-full-node |
| Delta |
+2 -1 |
+7 -1 |
ETC delta on v1.16.8 (+2 -1)
diff --git a/core/genesis.go b/core/genesis.go
index d0d490874..7ac9072b7 100644
--- a/core/genesis.go
+++ b/core/genesis.go
@@ -492,7 +492,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 {
@@ -565,6 +565,7 @@ func (g *Genesis) Commit(db ethdb.Database, triedb *triedb.Database) (*types.Blo
}
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())
ETC delta on v1.17.3 (+7 -1)
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())
← Back to Version Comparison