diff --git a/cmd/utils/customflags.go b/cmd/utils/customflags.go index 6db1f74be59..0fdb6f9e954 100644 --- a/cmd/utils/customflags.go +++ b/cmd/utils/customflags.go @@ -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 } @@ -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) }) } diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 171d7e812a6..4384401fb0d 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -134,6 +134,10 @@ var ( Name: "whitelist", Usage: "Comma separated block number-to-hash mappings to enforce (=)", } + OverrideTerminalTotalDifficulty = BigFlag{ + Name: "override.terminaltotaldifficulty", + Usage: "Manually specify TerminalTotalDifficulty, overriding the bundled setting", + } // Ethash settings EthashCachesInMemoryFlag = cli.IntFlag{ Name: "ethash.cachesinmem", @@ -1492,6 +1496,10 @@ func SetEthConfig(ctx *cli.Context, nodeConfig *node.Config, cfg *ethconfig.Conf cfg.Miner.GasPrice = big.NewInt(1) } } + + if ctx.GlobalIsSet(OverrideTerminalTotalDifficulty.Name) { + cfg.Genesis.Config.TerminalTotalDifficulty = GlobalBig(ctx, OverrideTerminalTotalDifficulty.Name) + } } // SetDNSDiscoveryDefaults configures DNS discovery with the given URL if diff --git a/turbo/cli/default_flags.go b/turbo/cli/default_flags.go index 276b7613708..f66bf3821b8 100644 --- a/turbo/cli/default_flags.go +++ b/turbo/cli/default_flags.go @@ -124,4 +124,5 @@ var DefaultFlags = []cli.Flag{ utils.HeimdallURLFlag, utils.WithoutHeimdallFlag, utils.EthStatsURLFlag, + utils.OverrideTerminalTotalDifficulty, }