Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R4R: Add --chain-id to testnet command #2749

Merged
merged 2 commits into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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