Skip to content

Commit 0c9c543

Browse files
committed
Merge branch 'release/0.9.36' into develop
2 parents 9e7d5d9 + d673c34 commit 0c9c543

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

cmd/geth/main.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import (
4949

5050
const (
5151
ClientIdentifier = "Geth"
52-
Version = "0.9.35"
52+
Version = "0.9.36"
5353
)
5454

5555
var (
@@ -458,17 +458,20 @@ func execJSFiles(ctx *cli.Context) {
458458

459459
func unlockAccount(ctx *cli.Context, am *accounts.Manager, addr string, i int) (addrHex, auth string) {
460460
var err error
461-
addrHex = utils.ParamToAddress(addr, am)
462-
// Attempt to unlock the account 3 times
463-
attempts := 3
464-
for tries := 0; tries < attempts; tries++ {
465-
msg := fmt.Sprintf("Unlocking account %s | Attempt %d/%d", addr, tries+1, attempts)
466-
auth = getPassPhrase(ctx, msg, false, i)
467-
err = am.Unlock(common.HexToAddress(addrHex), auth)
468-
if err == nil {
469-
break
461+
addrHex, err = utils.ParamToAddress(addr, am)
462+
if err == nil {
463+
// Attempt to unlock the account 3 times
464+
attempts := 3
465+
for tries := 0; tries < attempts; tries++ {
466+
msg := fmt.Sprintf("Unlocking account %s | Attempt %d/%d", addr, tries+1, attempts)
467+
auth = getPassPhrase(ctx, msg, false, i)
468+
err = am.Unlock(common.HexToAddress(addrHex), auth)
469+
if err == nil {
470+
break
471+
}
470472
}
471473
}
474+
472475
if err != nil {
473476
utils.Fatalf("Unlock account failed '%v'", err)
474477
}

cmd/utils/flags.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
369369
clientID += "/" + customName
370370
}
371371
am := MakeAccountManager(ctx)
372+
etherbase, err := ParamToAddress(ctx.GlobalString(EtherbaseFlag.Name), am)
373+
if err != nil {
374+
glog.V(logger.Error).Infoln("WARNING: No etherbase set and no accounts found as default")
375+
}
372376

373377
return &eth.Config{
374378
Name: common.MakeName(clientID, version),
@@ -380,7 +384,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
380384
LogFile: ctx.GlobalString(LogFileFlag.Name),
381385
Verbosity: ctx.GlobalInt(VerbosityFlag.Name),
382386
LogJSON: ctx.GlobalString(LogJSONFlag.Name),
383-
Etherbase: common.HexToAddress(ParamToAddress(ctx.GlobalString(EtherbaseFlag.Name), am)),
387+
Etherbase: common.HexToAddress(etherbase),
384388
MinerThreads: ctx.GlobalInt(MinerThreadsFlag.Name),
385389
AccountManager: am,
386390
VmDebug: ctx.GlobalBool(VMDebugFlag.Name),
@@ -508,7 +512,7 @@ func StartPProf(ctx *cli.Context) {
508512
}()
509513
}
510514

511-
func ParamToAddress(addr string, am *accounts.Manager) (addrHex string) {
515+
func ParamToAddress(addr string, am *accounts.Manager) (addrHex string, err error) {
512516
if !((len(addr) == 40) || (len(addr) == 42)) { // with or without 0x
513517
index, err := strconv.Atoi(addr)
514518
if err != nil {
@@ -517,7 +521,7 @@ func ParamToAddress(addr string, am *accounts.Manager) (addrHex string) {
517521

518522
addrHex, err = am.AddressByIndex(index)
519523
if err != nil {
520-
Fatalf("%v", err)
524+
return "", err
521525
}
522526
} else {
523527
addrHex = addr

common/natspec/natspec_e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func testEth(t *testing.T) (ethereum *eth.Ethereum, err error) {
141141
AccountManager: am,
142142
MaxPeers: 0,
143143
PowTest: true,
144-
Etherbase: testAddress,
144+
Etherbase: common.HexToAddress(testAddress),
145145
})
146146

147147
if err != nil {

0 commit comments

Comments
 (0)