Skip to content

Commit

Permalink
cmd/geth: adds extradata flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kobigurk committed Sep 15, 2015
1 parent 55bdcfa commit 321733a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 321733a

Please sign in to comment.