aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/main.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-07-07 18:53:36 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-07-07 18:53:36 +0800
commitbfcac89881f241d48488ace7774ea6e5195e9f22 (patch)
tree70a66c8f6186995d40f05b7ce3b58082917b5b4f /cmd/geth/main.go
parentdb06906c4fa31cb3f8e8528e31ceb7c3adb78af3 (diff)
downloaddexon-bfcac89881f241d48488ace7774ea6e5195e9f22.tar
dexon-bfcac89881f241d48488ace7774ea6e5195e9f22.tar.gz
dexon-bfcac89881f241d48488ace7774ea6e5195e9f22.tar.bz2
dexon-bfcac89881f241d48488ace7774ea6e5195e9f22.tar.lz
dexon-bfcac89881f241d48488ace7774ea6e5195e9f22.tar.xz
dexon-bfcac89881f241d48488ace7774ea6e5195e9f22.tar.zst
dexon-bfcac89881f241d48488ace7774ea6e5195e9f22.zip
cmd/geth, cmd/utils: changed ParamsToAddress to return error
ParamsToAddress no longer aborts the process, it now returns an error instead so that the caller can handle the error properly.
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r--cmd/geth/main.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index c29d4a257..2789601ac 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -461,17 +461,20 @@ func execJSFiles(ctx *cli.Context) {
func unlockAccount(ctx *cli.Context, am *accounts.Manager, addr string, i int) (addrHex, auth string) {
var err error
- addrHex = utils.ParamToAddress(addr, am)
- // Attempt to unlock the account 3 times
- attempts := 3
- for tries := 0; tries < attempts; tries++ {
- msg := fmt.Sprintf("Unlocking account %s | Attempt %d/%d", addr, tries+1, attempts)
- auth = getPassPhrase(ctx, msg, false, i)
- err = am.Unlock(common.HexToAddress(addrHex), auth)
- if err == nil {
- break
+ addrHex, err = utils.ParamToAddress(addr, am)
+ if err == nil {
+ // Attempt to unlock the account 3 times
+ attempts := 3
+ for tries := 0; tries < attempts; tries++ {
+ msg := fmt.Sprintf("Unlocking account %s | Attempt %d/%d", addr, tries+1, attempts)
+ auth = getPassPhrase(ctx, msg, false, i)
+ err = am.Unlock(common.HexToAddress(addrHex), auth)
+ if err == nil {
+ break
+ }
}
}
+
if err != nil {
utils.Fatalf("Unlock account failed '%v'", err)
}