Skip to content

Commit ba9f7c9

Browse files
rjl493456442atif-konasl
authored andcommitted
cmd: extend dumpgenesis to support network flags on the cmd (ethereum#22406)
1 parent d6ef5ef commit ba9f7c9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

cmd/geth/chaincmd.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ It expects the genesis file as argument.`,
6262
Usage: "Dumps genesis block JSON configuration to stdout",
6363
ArgsUsage: "",
6464
Flags: []cli.Flag{
65-
utils.DataDirFlag,
65+
utils.MainnetFlag,
66+
utils.RopstenFlag,
67+
utils.RinkebyFlag,
68+
utils.GoerliFlag,
69+
utils.YoloV3Flag,
6670
},
6771
Category: "BLOCKCHAIN COMMANDS",
6872
Description: `
@@ -227,6 +231,7 @@ func initGenesis(ctx *cli.Context) error {
227231
}
228232

229233
func dumpGenesis(ctx *cli.Context) error {
234+
// TODO(rjl493456442) support loading from the custom datadir
230235
genesis := utils.MakeGenesis(ctx)
231236
if genesis == nil {
232237
genesis = core.DefaultGenesisBlock()

cmd/utils/flags.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,6 +1777,8 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node) ethdb.Database {
17771777
func MakeGenesis(ctx *cli.Context) *core.Genesis {
17781778
var genesis *core.Genesis
17791779
switch {
1780+
case ctx.GlobalBool(MainnetFlag.Name):
1781+
genesis = core.DefaultGenesisBlock()
17801782
case ctx.GlobalBool(RopstenFlag.Name):
17811783
genesis = core.DefaultRopstenGenesisBlock()
17821784
case ctx.GlobalBool(RinkebyFlag.Name):

0 commit comments

Comments
 (0)