aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils
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/utils
parent4b5c99d97fa885352f11007adbb5c3e2c194e353 (diff)
downloaddexon-ee04b718876438feb0ed6d794f0caf72d24f777a.tar
dexon-ee04b718876438feb0ed6d794f0caf72d24f777a.tar.gz
dexon-ee04b718876438feb0ed6d794f0caf72d24f777a.tar.bz2
dexon-ee04b718876438feb0ed6d794f0caf72d24f777a.tar.lz
dexon-ee04b718876438feb0ed6d794f0caf72d24f777a.tar.xz
dexon-ee04b718876438feb0ed6d794f0caf72d24f777a.tar.zst
dexon-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/utils')
-rw-r--r--cmd/utils/flags.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index d58c754fe..903c97e71 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -369,6 +369,10 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
clientID += "/" + customName
}
am := MakeAccountManager(ctx)
+ etherbase, err := ParamToAddress(ctx.GlobalString(EtherbaseFlag.Name), am)
+ if err != nil {
+ glog.V(logger.Error).Infoln("WARNING: No etherbase set and no accounts found as default")
+ }
return &eth.Config{
Name: common.MakeName(clientID, version),
@@ -380,7 +384,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
LogFile: ctx.GlobalString(LogFileFlag.Name),
Verbosity: ctx.GlobalInt(VerbosityFlag.Name),
LogJSON: ctx.GlobalString(LogJSONFlag.Name),
- Etherbase: common.HexToAddress(ParamToAddress(ctx.GlobalString(EtherbaseFlag.Name), am)),
+ Etherbase: common.HexToAddress(etherbase),
MinerThreads: ctx.GlobalInt(MinerThreadsFlag.Name),
AccountManager: am,
VmDebug: ctx.GlobalBool(VMDebugFlag.Name),
@@ -508,7 +512,7 @@ func StartPProf(ctx *cli.Context) {
}()
}
-func ParamToAddress(addr string, am *accounts.Manager) (addrHex string) {
+func ParamToAddress(addr string, am *accounts.Manager) (addrHex string, err error) {
if !((len(addr) == 40) || (len(addr) == 42)) { // with or without 0x
index, err := strconv.Atoi(addr)
if err != nil {
@@ -517,7 +521,7 @@ func ParamToAddress(addr string, am *accounts.Manager) (addrHex string) {
addrHex, err = am.AddressByIndex(index)
if err != nil {
- Fatalf("%v", err)
+ return "", err
}
} else {
addrHex = addr