aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/main.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-05-20 03:46:32 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-05-20 03:46:32 +0800
commit32b8565022d7d6ccb437769b5ed68121c5c34657 (patch)
treec364e4a857c33e86a7db309f48d7473cdea2c9f7 /cmd/geth/main.go
parentaf8ada45e7d98527a21049e06a8bda307a083301 (diff)
downloadgo-tangerine-32b8565022d7d6ccb437769b5ed68121c5c34657.tar.gz
go-tangerine-32b8565022d7d6ccb437769b5ed68121c5c34657.tar.zst
go-tangerine-32b8565022d7d6ccb437769b5ed68121c5c34657.zip
Support multiple account unlock attempts
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r--cmd/geth/main.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 28a558d68..2afc92f10 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -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)
}