Fixed the --recover flag not working properly inside the init command (#9201)

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
This commit is contained in:
Riccardo Montagnin 2021-04-26 20:33:30 +02:00 committed by GitHub
parent 49bf0774bc
commit fdbc32e50c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -89,11 +89,12 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command {
recover, _ := cmd.Flags().GetBool(FlagRecover)
if recover {
inBuf := bufio.NewReader(cmd.InOrStdin())
mnemonic, err := input.GetString("Enter your bip39 mnemonic", inBuf)
value, err := input.GetString("Enter your bip39 mnemonic", inBuf)
if err != nil {
return err
}
mnemonic = value
if !bip39.IsMnemonicValid(mnemonic) {
return errors.New("invalid mnemonic")
}