aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKobi Gurkan <kobigurk@gmail.com>2015-09-16 04:35:36 +0800
committerKobi Gurkan <kobigurk@gmail.com>2015-09-16 04:35:36 +0800
commit321733ab2349c411cb584b0f88d58c01afa7f83b (patch)
tree95ff40742241d2d21faff99b95d5f7b35d87a449
parent55bdcfaeac15b5025ecd485f0d9255a86d4de270 (diff)
downloaddexon-321733ab2349c411cb584b0f88d58c01afa7f83b.tar
dexon-321733ab2349c411cb584b0f88d58c01afa7f83b.tar.gz
dexon-321733ab2349c411cb584b0f88d58c01afa7f83b.tar.bz2
dexon-321733ab2349c411cb584b0f88d58c01afa7f83b.tar.lz
dexon-321733ab2349c411cb584b0f88d58c01afa7f83b.tar.xz
dexon-321733ab2349c411cb584b0f88d58c01afa7f83b.tar.zst
dexon-321733ab2349c411cb584b0f88d58c01afa7f83b.zip
cmd/geth: adds extradata flag
-rw-r--r--cmd/geth/main.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index ba753a493..f546f89cc 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -58,6 +58,11 @@ var (
gitCommit string // set via linker flagg
nodeNameVersion string
app *cli.App
+
+ ExtraDataFlag = cli.StringFlag{
+ Name: "extradata",
+ Usage: "Extra data for the miner",
+ }
)
func init() {
@@ -331,6 +336,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.GpobaseStepDownFlag,
utils.GpobaseStepUpFlag,
utils.GpobaseCorrectionFactorFlag,
+ ExtraDataFlag,
}
app.Before = func(ctx *cli.Context) error {
utils.SetupLogger(ctx)
@@ -354,6 +360,14 @@ func main() {
}
}
+// MakeExtra resolves extradata for the miner from a flag or returns a default.
+func makeExtra(ctx *cli.Context) []byte {
+ if ctx.GlobalIsSet(ExtraDataFlag.Name) {
+ return []byte(ctx.GlobalString(ExtraDataFlag.Name))
+ }
+ return makeDefaultExtra()
+}
+
func makeDefaultExtra() []byte {
var clientInfo = struct {
Version uint
@@ -382,7 +396,7 @@ func run(ctx *cli.Context) {
}
cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx)
- cfg.ExtraData = makeDefaultExtra()
+ cfg.ExtraData = makeExtra(ctx)
ethereum, err := eth.New(cfg)
if err != nil {