|
@@ -9,6 +9,7 @@ import (
|
|
|
"os"
|
|
"os"
|
|
|
"path/filepath"
|
|
"path/filepath"
|
|
|
"runtime"
|
|
"runtime"
|
|
|
|
|
+ "strconv"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/metrics"
|
|
"github.com/ethereum/go-ethereum/metrics"
|
|
|
|
|
|
|
@@ -122,8 +123,8 @@ var (
|
|
|
}
|
|
}
|
|
|
EtherbaseFlag = cli.StringFlag{
|
|
EtherbaseFlag = cli.StringFlag{
|
|
|
Name: "etherbase",
|
|
Name: "etherbase",
|
|
|
- Usage: "Public address for block mining rewards. By default the address of your primary account is used",
|
|
|
|
|
- Value: "primary",
|
|
|
|
|
|
|
+ Usage: "Public address for block mining rewards. By default the address first created is used",
|
|
|
|
|
+ Value: "0",
|
|
|
}
|
|
}
|
|
|
GasPriceFlag = cli.StringFlag{
|
|
GasPriceFlag = cli.StringFlag{
|
|
|
Name: "gasprice",
|
|
Name: "gasprice",
|
|
@@ -351,6 +352,8 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
|
|
|
if len(customName) > 0 {
|
|
if len(customName) > 0 {
|
|
|
clientID += "/" + customName
|
|
clientID += "/" + customName
|
|
|
}
|
|
}
|
|
|
|
|
+ am := MakeAccountManager(ctx)
|
|
|
|
|
+
|
|
|
return ð.Config{
|
|
return ð.Config{
|
|
|
Name: common.MakeName(clientID, version),
|
|
Name: common.MakeName(clientID, version),
|
|
|
DataDir: ctx.GlobalString(DataDirFlag.Name),
|
|
DataDir: ctx.GlobalString(DataDirFlag.Name),
|
|
@@ -361,9 +364,9 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
|
|
|
LogFile: ctx.GlobalString(LogFileFlag.Name),
|
|
LogFile: ctx.GlobalString(LogFileFlag.Name),
|
|
|
Verbosity: ctx.GlobalInt(VerbosityFlag.Name),
|
|
Verbosity: ctx.GlobalInt(VerbosityFlag.Name),
|
|
|
LogJSON: ctx.GlobalString(LogJSONFlag.Name),
|
|
LogJSON: ctx.GlobalString(LogJSONFlag.Name),
|
|
|
- Etherbase: ctx.GlobalString(EtherbaseFlag.Name),
|
|
|
|
|
|
|
+ Etherbase: common.HexToAddress(ParamToAddress(ctx.GlobalString(EtherbaseFlag.Name), am)),
|
|
|
MinerThreads: ctx.GlobalInt(MinerThreadsFlag.Name),
|
|
MinerThreads: ctx.GlobalInt(MinerThreadsFlag.Name),
|
|
|
- AccountManager: MakeAccountManager(ctx),
|
|
|
|
|
|
|
+ AccountManager: am,
|
|
|
VmDebug: ctx.GlobalBool(VMDebugFlag.Name),
|
|
VmDebug: ctx.GlobalBool(VMDebugFlag.Name),
|
|
|
MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name),
|
|
MaxPeers: ctx.GlobalInt(MaxPeersFlag.Name),
|
|
|
MaxPendingPeers: ctx.GlobalInt(MaxPendingPeersFlag.Name),
|
|
MaxPendingPeers: ctx.GlobalInt(MaxPendingPeersFlag.Name),
|
|
@@ -488,3 +491,20 @@ func StartPProf(ctx *cli.Context) {
|
|
|
log.Println(http.ListenAndServe(address, nil))
|
|
log.Println(http.ListenAndServe(address, nil))
|
|
|
}()
|
|
}()
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+func ParamToAddress(addr string, am *accounts.Manager) (addrHex string) {
|
|
|
|
|
+ if !((len(addr) == 40) || (len(addr) == 42)) { // with or without 0x
|
|
|
|
|
+ index, err := strconv.Atoi(addr)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ Fatalf("Invalid account address '%s'", addr)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ addrHex, err = am.AddressByIndex(index)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ Fatalf("%v", err)
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ addrHex = addr
|
|
|
|
|
+ }
|
|
|
|
|
+ return
|
|
|
|
|
+}
|