Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/geth: allow for big ttd #24646

Merged
merged 4 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,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
7 changes: 4 additions & 3 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)
if !ok {
intVal, ok := math.ParseBig256(s)
if !ok || intVal == nil {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intVal == nil check is not needed, right? Ideally, anything that got parsed successfully should return a non-nil value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

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 @@ -258,7 +258,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