Skip to content

Commit ec88bd0

Browse files
authored
cmd/geth: dont fail on deprecated toml config fields (#23118)
1 parent acdf923 commit ec88bd0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cmd/geth/config.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/ethereum/go-ethereum/eth/catalyst"
3232
"github.com/ethereum/go-ethereum/eth/ethconfig"
3333
"github.com/ethereum/go-ethereum/internal/ethapi"
34+
"github.com/ethereum/go-ethereum/log"
3435
"github.com/ethereum/go-ethereum/metrics"
3536
"github.com/ethereum/go-ethereum/node"
3637
"github.com/ethereum/go-ethereum/params"
@@ -63,7 +64,12 @@ var tomlSettings = toml.Config{
6364
return field
6465
},
6566
MissingField: func(rt reflect.Type, field string) error {
66-
link := ""
67+
id := fmt.Sprintf("%s.%s", rt.String(), field)
68+
if deprecated(id) {
69+
log.Warn("Config field is deprecated and won't have an effect", "name", id)
70+
return nil
71+
}
72+
var link string
6773
if unicode.IsUpper(rune(rt.Name()[0])) && rt.PkgPath() != "main" {
6874
link = fmt.Sprintf(", see https://godoc.org/%s#%s for available fields", rt.PkgPath(), rt.Name())
6975
}
@@ -228,3 +234,7 @@ func applyMetricConfig(ctx *cli.Context, cfg *gethConfig) {
228234
cfg.Metrics.InfluxDBTags = ctx.GlobalString(utils.MetricsInfluxDBTagsFlag.Name)
229235
}
230236
}
237+
238+
func deprecated(field string) bool {
239+
return false
240+
}

0 commit comments

Comments
 (0)