diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 6f2b6ca053..bbadb1cc19 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -230,8 +230,6 @@ func initGenesis(ctx *cli.Context) error { triedb := utils.MakeTrieDatabase(ctx, chaindb, ctx.Bool(utils.CachePreimagesFlag.Name), false, genesis.IsVerkle()) defer triedb.Close() - // Set initing genesis here, to signal that we are in an initGenesis flow. - genesis.SetInitingGenesis() _, hash, _, err := core.SetupGenesisBlockWithOverride(chaindb, triedb, genesis, &overrides) if err != nil { utils.Fatalf("Failed to write genesis block: %v", err) diff --git a/core/celo_genesis.go b/core/celo_genesis.go index 6a5005207b..1e37f55b8f 100644 --- a/core/celo_genesis.go +++ b/core/celo_genesis.go @@ -167,13 +167,3 @@ func addFeeCurrencyToStorage(feeCurrencyAddr common.Address, oracleAddr common.A storage[structStart] = common.BytesToHash(oracleAddr.Bytes()) // oracle storage[incHash(structStart, 1)] = common.BigToHash(big.NewInt(int64(FeeCurrencyIntrinsicGas))) // intrinsicGas } - -// SetInitingGenesis marks this genesis as one that is being used in the initGenesis operation. -func (g *Genesis) SetInitingGenesis() { - g.initingGenesis = true -} - -// InitingGenesis returns true if this genesis is being used in the initGenesis operation. -func (g *Genesis) InitingGenesis() bool { - return g.initingGenesis -} diff --git a/core/genesis.go b/core/genesis.go index ae46173a4b..c4e6068685 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -23,6 +23,7 @@ import ( "fmt" "math/big" "strings" + "testing" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -79,10 +80,6 @@ type Genesis struct { // Chains with history pruning, or extraordinarily large genesis allocation (e.g. after a regenesis event) // may utilize this to get started, and then state-sync the latest state, while still verifying the header chain. StateHash *common.Hash `json:"stateHash,omitempty"` - - // initingGenesis is used to indicate whether this genesis config is being - // used in the initGenesis operation. - initingGenesis bool } func ReadGenesis(db ethdb.Database) (*Genesis, error) { @@ -601,7 +598,7 @@ func (g *Genesis) toBlockWithRoot(stateRoot, storageRootMessagePasser common.Has // condition, but TestFeeHistory, makes use of chains with pre-gingerbread // genesis blocks without actually accounting for the different structure of // the pre-gingerbread block. - if g.InitingGenesis() && g.Config.GingerbreadBlock != nil && !g.Config.IsGingerbread(number) { + if !testing.Testing() && g.Config.GingerbreadBlock != nil && !g.Config.IsGingerbread(number) { head = types.NewPreGingerbreadHeader() }