mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
Fix Accounts Creation Error (#6748)
* add check * Merge refs/heads/master into fixAccountsError * Merge refs/heads/master into fixAccountsError
This commit is contained in:
parent
7861005990
commit
8a69d34b96
@ -20,6 +20,21 @@ var log = logrus.WithField("prefix", "accounts-v2")
|
|||||||
// a wallet from the user's specified path.
|
// a wallet from the user's specified path.
|
||||||
func CreateAccount(cliCtx *cli.Context) error {
|
func CreateAccount(cliCtx *cli.Context) error {
|
||||||
ctx := context.Background()
|
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)
|
wallet, err := OpenWallet(cliCtx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "could not open wallet")
|
return errors.Wrap(err, "could not open wallet")
|
||||||
|
@ -117,7 +117,6 @@ func inputPassword(cliCtx *cli.Context, promptText string, confirmPassword passw
|
|||||||
}
|
}
|
||||||
return strings.TrimRight(enteredPassword, "\r\n"), nil
|
return strings.TrimRight(enteredPassword, "\r\n"), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasValidPassword bool
|
var hasValidPassword bool
|
||||||
var walletPassword string
|
var walletPassword string
|
||||||
var err error
|
var err error
|
||||||
@ -132,7 +131,6 @@ func inputPassword(cliCtx *cli.Context, promptText string, confirmPassword passw
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("could not read account password: %v", formatPromptError(err))
|
return "", fmt.Errorf("could not read account password: %v", formatPromptError(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if confirmPassword == confirmPass {
|
if confirmPassword == confirmPass {
|
||||||
prompt = promptui.Prompt{
|
prompt = promptui.Prompt{
|
||||||
Label: confirmPasswordPromptText,
|
Label: confirmPasswordPromptText,
|
||||||
|
Loading…
Reference in New Issue
Block a user