mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
core: copy genesis before modifying
This commit is contained in:
parent
5803554aae
commit
16b6c4c4e2
1 changed files with 2 additions and 2 deletions
|
|
@ -283,7 +283,7 @@ func SetupGenesisBlock(db ethdb.Database, triedb *triedb.Database, genesis *Gene
|
||||||
func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *triedb.Database, origGenesis *Genesis, overrides *ChainOverrides) (*params.ChainConfig, common.Hash, *params.ConfigCompatError, error) {
|
func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *triedb.Database, origGenesis *Genesis, overrides *ChainOverrides) (*params.ChainConfig, common.Hash, *params.ConfigCompatError, error) {
|
||||||
// Sanitize the supplied genesis, ensuring it has the associated chain
|
// Sanitize the supplied genesis, ensuring it has the associated chain
|
||||||
// config attached.
|
// config attached.
|
||||||
genesis := origGenesis.Copy()
|
genesis := origGenesis.copy()
|
||||||
if genesis != nil && genesis.Config == nil {
|
if genesis != nil && genesis.Config == nil {
|
||||||
return nil, common.Hash{}, nil, errGenesisNoConfig
|
return nil, common.Hash{}, nil, errGenesisNoConfig
|
||||||
}
|
}
|
||||||
|
|
@ -552,7 +552,7 @@ func (g *Genesis) MustCommit(db ethdb.Database, triedb *triedb.Database) *types.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy copies the genesis.
|
// Copy copies the genesis.
|
||||||
func (g *Genesis) Copy() *Genesis {
|
func (g *Genesis) copy() *Genesis {
|
||||||
if g != nil {
|
if g != nil {
|
||||||
cpy := *g
|
cpy := *g
|
||||||
if g.Config != nil {
|
if g.Config != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue