Fix Accounts Creation Error (#6748)

* add check
* Merge refs/heads/master into fixAccountsError
* Merge refs/heads/master into fixAccountsError
This commit is contained in:
Nishant Das 2020-07-29 00:06:18 +08:00 committed by GitHub
parent 7861005990
commit 8a69d34b96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -20,6 +20,21 @@ var log = logrus.WithField("prefix", "accounts-v2")
// a wallet from the user's specified path.
func CreateAccount(cliCtx *cli.Context) error {
ctx := context.Background()
walletDir, err := inputDirectory(cliCtx, walletDirPromptText, flags.WalletDirFlag)
if err != nil {
return errors.Wrapf(err, "Could not retrieve input directory")
}
ok, err := hasDir(walletDir)
if err != nil {
return err
}
// Create a new wallet if no directory exists.
if !ok {
err = CreateWallet(cliCtx)
if err != nil {
return errors.Wrapf(err, "Could not create wallet")
}
}
wallet, err := OpenWallet(cliCtx)
if err != nil {
return errors.Wrap(err, "could not open wallet")

View File

@ -117,7 +117,6 @@ func inputPassword(cliCtx *cli.Context, promptText string, confirmPassword passw
}
return strings.TrimRight(enteredPassword, "\r\n"), nil
}
var hasValidPassword bool
var walletPassword string
var err error
@ -132,7 +131,6 @@ func inputPassword(cliCtx *cli.Context, promptText string, confirmPassword passw
if err != nil {
return "", fmt.Errorf("could not read account password: %v", formatPromptError(err))
}
if confirmPassword == confirmPass {
prompt = promptui.Prompt{
Label: confirmPasswordPromptText,