Require --name on init gen-tx

This commit is contained in:
Christopher Goes 2018-05-22 10:40:04 +02:00
parent 5e858129c5
commit 8f4234b44d
No known key found for this signature in database
GPG Key ID: E828D98232D328D3
1 changed files with 4 additions and 1 deletions

View File

@ -65,7 +65,7 @@ func GaiaAppInit() server.AppInit {
fsAppGenState := pflag.NewFlagSet("", pflag.ContinueOnError)
fsAppGenTx := pflag.NewFlagSet("", pflag.ContinueOnError)
fsAppGenTx.String(flagName, "", "validator moniker, if left blank, do not add validator")
fsAppGenTx.String(flagName, "", "validator moniker, required")
fsAppGenTx.String(flagClientHome, DefaultCLIHome,
"home directory for the client, used for key generation")
fsAppGenTx.Bool(flagOWK, false, "overwrite the accounts created")
@ -94,6 +94,9 @@ func GaiaAppGenTx(cdc *wire.Codec, pk crypto.PubKey) (
clientRoot := viper.GetString(flagClientHome)
overwrite := viper.GetBool(flagOWK)
name := viper.GetString(flagName)
if name == "" {
return nil, nil, tmtypes.GenesisValidator{}, errors.New("Must specify --name (validator moniker)")
}
addr, secret, err = server.GenerateSaveCoinKey(clientRoot, name, "1234567890", overwrite)
if err != nil {
return