forked from cerc-io/plugeth
core, cmd/geth: add --override.* flags to geth init (#28407)
* core, cmd/geth: add --override.* flags to geth init * also apply overrides before genesis commit with new block * review feedback
This commit is contained in:
+3
-2
@@ -287,11 +287,11 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen
|
||||
} else {
|
||||
log.Info("Writing custom genesis block")
|
||||
}
|
||||
applyOverrides(genesis.Config)
|
||||
block, err := genesis.Commit(db, triedb)
|
||||
if err != nil {
|
||||
return genesis.Config, common.Hash{}, err
|
||||
}
|
||||
applyOverrides(genesis.Config)
|
||||
return genesis.Config, block.Hash(), nil
|
||||
}
|
||||
// The genesis block is present(perhaps in ancient database) while the
|
||||
@@ -303,6 +303,7 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen
|
||||
if genesis == nil {
|
||||
genesis = DefaultGenesisBlock()
|
||||
}
|
||||
applyOverrides(genesis.Config)
|
||||
// Ensure the stored genesis matches with the given one.
|
||||
hash := genesis.ToBlock().Hash()
|
||||
if hash != stored {
|
||||
@@ -312,11 +313,11 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen
|
||||
if err != nil {
|
||||
return genesis.Config, hash, err
|
||||
}
|
||||
applyOverrides(genesis.Config)
|
||||
return genesis.Config, block.Hash(), nil
|
||||
}
|
||||
// Check whether the genesis block is already written.
|
||||
if genesis != nil {
|
||||
applyOverrides(genesis.Config)
|
||||
hash := genesis.ToBlock().Hash()
|
||||
if hash != stored {
|
||||
return genesis.Config, hash, &GenesisMismatchError{stored, hash}
|
||||
|
||||
Reference in New Issue
Block a user