good morning!!!!

Skip to content
Snippets Groups Projects
Commit 32b85650 authored by Taylor Gerring's avatar Taylor Gerring
Browse files

Support multiple account unlock attempts

parent af8ada45
No related branches found
No related tags found
No related merge requests found
......@@ -368,9 +368,16 @@ func unlockAccount(ctx *cli.Context, am *accounts.Manager, account string) (pass
if len(account) == 0 {
utils.Fatalf("Invalid account address '%s'", account)
}
// Attempt to unlock the account
passphrase = getPassPhrase(ctx, "Unlocking account "+account, false)
err = am.Unlock(common.HexToAddress(account), passphrase)
// Attempt to unlock the account 3 times
attempts := 3
for tries := 0; tries < attempts; tries++ {
msg := fmt.Sprintf("Unlocking account %s...%s | Attempt %d/%d", account[:8], account[len(account)-6:], tries+1, attempts)
passphrase = getPassPhrase(ctx, msg, false)
err = am.Unlock(common.HexToAddress(account), passphrase)
if err == nil {
break
}
}
if err != nil {
utils.Fatalf("Unlock account failed '%v'", err)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment