Skip to content

Commit

Permalink
cmd: extend dumpgenesis to support network flags on the cmd (ethereum…
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 authored and atif-konasl committed Oct 15, 2021
1 parent d6ef5ef commit ba9f7c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ It expects the genesis file as argument.`,
Usage: "Dumps genesis block JSON configuration to stdout",
ArgsUsage: "",
Flags: []cli.Flag{
utils.DataDirFlag,
utils.MainnetFlag,
utils.RopstenFlag,
utils.RinkebyFlag,
utils.GoerliFlag,
utils.YoloV3Flag,
},
Category: "BLOCKCHAIN COMMANDS",
Description: `
Expand Down Expand Up @@ -227,6 +231,7 @@ func initGenesis(ctx *cli.Context) error {
}

func dumpGenesis(ctx *cli.Context) error {
// TODO(rjl493456442) support loading from the custom datadir
genesis := utils.MakeGenesis(ctx)
if genesis == nil {
genesis = core.DefaultGenesisBlock()
Expand Down
2 changes: 2 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,8 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node) ethdb.Database {
func MakeGenesis(ctx *cli.Context) *core.Genesis {
var genesis *core.Genesis
switch {
case ctx.GlobalBool(MainnetFlag.Name):
genesis = core.DefaultGenesisBlock()
case ctx.GlobalBool(RopstenFlag.Name):
genesis = core.DefaultRopstenGenesisBlock()
case ctx.GlobalBool(RinkebyFlag.Name):
Expand Down

0 comments on commit ba9f7c9

Please sign in to comment.