Skip to content

Commit

Permalink
cmd/geth: support bigints for --override.terminaltotaldifficulty (eth…
Browse files Browse the repository at this point in the history
…ereum#24646)


Co-authored-by: Felix Lange <fjl@twurst.com>
  • Loading branch information
2 people authored and cp-wjhan committed Nov 29, 2022
1 parent 2ad7192 commit 527f83a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
cfg.Eth.OverrideArrowGlacier = new(big.Int).SetUint64(ctx.GlobalUint64(utils.OverrideArrowGlacierFlag.Name))
}
if ctx.GlobalIsSet(utils.OverrideTerminalTotalDifficulty.Name) {
cfg.Eth.OverrideTerminalTotalDifficulty = new(big.Int).SetUint64(ctx.GlobalUint64(utils.OverrideTerminalTotalDifficulty.Name))
cfg.Eth.OverrideTerminalTotalDifficulty = utils.GlobalBig(ctx, utils.OverrideTerminalTotalDifficulty.Name)
}
backend, eth := utils.RegisterEthService(stack, &cfg.Eth)
// Warn users to migrate if they have a legacy freezer format.
Expand Down
5 changes: 3 additions & 2 deletions cmd/utils/customflags.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ func (b *bigValue) String() string {
}

func (b *bigValue) Set(s string) error {
int, ok := math.ParseBig256(s)
intVal, ok := math.ParseBig256(s)
if !ok {
return errors.New("invalid integer syntax")
}
*b = (bigValue)(*int)
*b = (bigValue)(*intVal)
return nil
}

Expand All @@ -172,6 +172,7 @@ func (f BigFlag) String() string {

func (f BigFlag) Apply(set *flag.FlagSet) {
eachName(f.Name, func(name string) {
f.Value = new(big.Int)
set.Var((*bigValue)(f.Value), f.Name, f.Usage)
})
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ var (
Name: "override.arrowglacier",
Usage: "Manually specify Arrow Glacier fork-block, overriding the bundled setting",
}
OverrideTerminalTotalDifficulty = cli.Uint64Flag{
OverrideTerminalTotalDifficulty = BigFlag{
Name: "override.terminaltotaldifficulty",
Usage: "Manually specify TerminalTotalDifficulty, overriding the bundled setting",
}
Expand Down

0 comments on commit 527f83a

Please sign in to comment.