mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/geth: dump a generic dev-mode compatible genesis configuration if dumpgenesis command is invoked without datadir specified
This commit is contained in:
parent
a3be38127c
commit
f681475a3d
1 changed files with 10 additions and 0 deletions
|
|
@ -232,6 +232,16 @@ func dumpGenesis(ctx *cli.Context) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// if a datadir isn't specified, dump a generic dev-mode compatible genesis configuration
|
||||
if ctx.IsSet(utils.DeveloperFlag.Name) && !ctx.IsSet(utils.DataDirFlag.Name) {
|
||||
genesis := core.DeveloperGenesisBlock(10_000_000, common.Address{})
|
||||
if err := json.NewEncoder(os.Stdout).Encode(genesis); err != nil {
|
||||
utils.Fatalf("could not encode genesis: %s", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// dump whatever already exists in the datadir
|
||||
stack, _ := makeConfigNode(ctx)
|
||||
for _, name := range []string{"chaindata", "lightchaindata"} {
|
||||
|
|
|
|||
Loading…
Reference in a new issue