forked from cerc-io/plugeth
Merge branch 'release/0.9.36' into develop
This commit is contained in:
commit
0c9c5439d4
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user