Skip to content

Commit

Permalink
cmd: add check for port number
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-EA committed Aug 25, 2023
1 parent 33db7c9 commit 1b53f15
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,18 +318,20 @@ func initNetwork(ctx *cli.Context) error {
utils.Fatalf("init.dir is required")
}
size := ctx.Int(utils.InitNetworkSize.Name)
if size <= 0 {
utils.Fatalf("size should be greater than 0")
}
port := ctx.Int(utils.InitNetworkPort.Name)
if port <= 0 {
utils.Fatalf("port should be greater than 0")
}
ipStr := ctx.String(utils.InitNetworkIps.Name)
cfgFile := ctx.String(configFileFlag.Name)

if len(cfgFile) == 0 {
utils.Fatalf("config file is required")
}

if size <= 0 {
utils.Fatalf("size should be greater than 0")
}

ips, err := parseIps(ipStr, size)
if err != nil {
utils.Fatalf("Failed to pase ips string: %v", err)
Expand Down

0 comments on commit 1b53f15

Please sign in to comment.