Skip to content

Commit 0207f72

Browse files
committed
Always read chain config from genesis
This will prevent problems where a node needs to be restarted twice before it could pick up a new hardfork from genesis. This was caused by an old version of chain config, which was previously stored in database, being used by a node at start. The commit will avoid reading any old chain config from db and always read it directly from a genesis file or from the binary itself.
1 parent 86d913a commit 0207f72

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

eth/backend.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -164,20 +164,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
164164
}
165165
}
166166

167-
// Here we determine genesis hash and active ChainConfig.
168-
// We need these to figure out the consensus parameters and to set up history pruning.
169-
chainConfig, _, err := core.LoadChainConfig(chainDb, config.Genesis)
170-
if err != nil {
171-
return nil, err
172-
}
173-
174-
/*
175-
engine, err := ethconfig.CreateConsensusEngine(chainConfig, chainDb)
176-
if err != nil {
177-
return nil, err
178-
}
179-
*/
180-
181167
// Assemble the Ethereum object.
182168
eth := &Ethereum{
183169
config: config,
@@ -204,7 +190,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
204190
gpoParams := config.GPO
205191

206192
blockChainAPI := ethapi.NewBlockChainAPI(eth.APIBackend)
207-
engine, err := ethconfig.CreateConsensusEngine(chainConfig, config, chainDb, blockChainAPI)
193+
engine, err := ethconfig.CreateConsensusEngine(config.Genesis.Config, config, chainDb, blockChainAPI)
208194
eth.engine = engine
209195
if err != nil {
210196
return nil, err

0 commit comments

Comments
 (0)