Check whether key passed with --name exists before redirecting to tx create-validator
Closes: #2804
This commit is contained in:
parent
7b7d45ddd2
commit
f2b38874ef
|
@ -3,6 +3,7 @@ package init
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
|
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
"github.com/cosmos/cosmos-sdk/server"
|
"github.com/cosmos/cosmos-sdk/server"
|
||||||
|
@ -61,6 +62,14 @@ following delegation and commission default parameters:
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kb, err := keys.GetKeyBaseFromDir(viper.GetString(flagClientHome))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if _, err = kb.Get(viper.GetString(client.FlagName)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// Read --pubkey, if empty take it from priv_validator.json
|
// Read --pubkey, if empty take it from priv_validator.json
|
||||||
if valPubKeyString := viper.GetString(cli.FlagPubKey); valPubKeyString != "" {
|
if valPubKeyString := viper.GetString(cli.FlagPubKey); valPubKeyString != "" {
|
||||||
valPubKey, err = sdk.GetConsPubKeyBech32(valPubKeyString)
|
valPubKey, err = sdk.GetConsPubKeyBech32(valPubKeyString)
|
||||||
|
|
Loading…
Reference in New Issue