Skip to content

Commit

Permalink
chg: changes for import/export command
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkanani committed Nov 18, 2020
1 parent 8c7cf1d commit 2bd4ad3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func dumpGenesis(ctx *cli.Context) error {
}

func importChain(ctx *cli.Context) error {
if len(ctx.Args()) < 1 {
if len(ctx.Args()) < 2 {
utils.Fatalf("This command requires an argument.")
}
// Start metrics export if enabled
Expand Down Expand Up @@ -308,13 +308,14 @@ func importChain(ctx *cli.Context) error {

var importErr error

if len(ctx.Args()) == 1 {
// ArgsUsage: "<filename> (<filename 2> ... <filename N>) <genesisPath>",
if len(ctx.Args()) == 2 {
if err := utils.ImportChain(chain, ctx.Args().First()); err != nil {
importErr = err
log.Error("Import error", "err", err)
}
} else {
for _, arg := range ctx.Args() {
for _, arg := range ctx.Args()[:len(ctx.Args())-1] {
if err := utils.ImportChain(chain, arg); err != nil {
importErr = err
log.Error("Import error", "file", arg, "err", err)
Expand Down

0 comments on commit 2bd4ad3

Please sign in to comment.