Skip to content

Commit

Permalink
cmd/utils: set default genesis if --mainnet is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusVanDerWijden committed Dec 15, 2020
1 parent 129221e commit ae00010
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,12 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
}
// Override any default configs for hard coded networks.
switch {
case ctx.GlobalBool(MainnetFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 1
}
cfg.Genesis = core.DefaultGenesisBlock()
SetDNSDiscoveryDefaults(cfg, params.MainnetGenesisHash)
case ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 3
Expand Down Expand Up @@ -1807,7 +1813,7 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node) ethdb.Database {
}

func MakeGenesis(ctx *cli.Context) *core.Genesis {
var genesis *core.Genesis
genesis := core.DefaultGenesisBlock()
switch {
case ctx.GlobalBool(LegacyTestnetFlag.Name) || ctx.GlobalBool(RopstenFlag.Name):
genesis = core.DefaultRopstenGenesisBlock()
Expand Down

0 comments on commit ae00010

Please sign in to comment.