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 20:55:27 +0800
commitee04b718876438feb0ed6d794f0caf72d24f777a (patch)
tree9e13cf50d937b680e173cbc596c04a5f1eebc098 /cmd/geth/main.go
parent4b5c99d97fa885352f11007adbb5c3e2c194e353 (diff)
downloadgo-tangerine-ee04b718876438feb0ed6d794f0caf72d24f777a.tar.gz
go-tangerine-ee04b718876438feb0ed6d794f0caf72d24f777a.tar.zst
go-tangerine-ee04b718876438feb0ed6d794f0caf72d24f777a.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 b9e9cd346..5ac93a983 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -458,17 +458,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)
}