diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-07-07 21:13:11 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-07-07 21:13:11 +0800 |
commit | 0c9c5439d44990817dbba2323971993149da2cce (patch) | |
tree | 4b77244b1ce72160a1434036977c7a473781665c | |
parent | 9e7d5d9d3b4ad686409fec7beb08792d38052a2c (diff) | |
parent | d673c34c8d4ae83a3765ed44ae9d0fb7ce1aa3c9 (diff) | |
download | dexon-0c9c5439d44990817dbba2323971993149da2cce.tar dexon-0c9c5439d44990817dbba2323971993149da2cce.tar.gz dexon-0c9c5439d44990817dbba2323971993149da2cce.tar.bz2 dexon-0c9c5439d44990817dbba2323971993149da2cce.tar.lz dexon-0c9c5439d44990817dbba2323971993149da2cce.tar.xz dexon-0c9c5439d44990817dbba2323971993149da2cce.tar.zst dexon-0c9c5439d44990817dbba2323971993149da2cce.zip |
Merge branch 'release/0.9.36' into develop
-rw-r--r-- | cmd/geth/main.go | 23 | ||||
-rw-r--r-- | cmd/utils/flags.go | 10 | ||||
-rw-r--r-- | common/natspec/natspec_e2e_test.go | 2 |
3 files changed, 21 insertions, 14 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index bb6ddc1e2..5ac93a983 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -49,7 +49,7 @@ import ( const ( ClientIdentifier = "Geth" - Version = "0.9.35" + Version = "0.9.36" ) var ( @@ -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) } 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 ð.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 diff --git a/common/natspec/natspec_e2e_test.go b/common/natspec/natspec_e2e_test.go index 890bdd9ca..0cbe040c0 100644 --- a/common/natspec/natspec_e2e_test.go +++ b/common/natspec/natspec_e2e_test.go @@ -141,7 +141,7 @@ func testEth(t *testing.T) (ethereum *eth.Ethereum, err error) { AccountManager: am, MaxPeers: 0, PowTest: true, - Etherbase: testAddress, + Etherbase: common.HexToAddress(testAddress), }) if err != nil { |