Skip to content

Commit

Permalink
Merge PR #2749: Add --chain-id to testnet command
Browse files Browse the repository at this point in the history
* Add --chain-id to testnet command
* Update PENDING.md
  • Loading branch information
cwgoes authored Nov 9, 2018
2 parents a4af659 + fc56dd0 commit 2aa14d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ IMPROVEMENTS
* Gaia REST API (`gaiacli advanced rest-server`)

* Gaia CLI (`gaiacli`)
* [\#2749](https://github.com/cosmos/cosmos-sdk/pull/2749) Add --chain-id flag to gaiad testnet

* Gaia

Expand Down
8 changes: 7 additions & 1 deletion cmd/gaia/init/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,20 @@ Example:
cmd.Flags().String(flagStartingIPAddress, "192.168.0.1",
"Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)")

cmd.Flags().String(client.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created")

return cmd
}

func initTestnet(config *cfg.Config, cdc *codec.Codec) error {
var chainID string
outDir := viper.GetString(flagOutputDir)
numValidators := viper.GetInt(flagNumValidators)

chainID := "chain-" + cmn.RandStr(6)
chainID = viper.GetString(client.FlagChainID)
if chainID == "" {
chainID = "chain-" + cmn.RandStr(6)
}

monikers := make([]string, numValidators)
nodeIDs := make([]string, numValidators)
Expand Down

0 comments on commit 2aa14d9

Please sign in to comment.