From cfb72501bf12ea766e25328727fc27ce084217f4 Mon Sep 17 00:00:00 2001 From: JukLee0ira Date: Wed, 13 Nov 2024 11:35:41 +0800 Subject: [PATCH] cmd/geth: print warning when whisper config is present in toml (#21544) --- cmd/XDC/config.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cmd/XDC/config.go b/cmd/XDC/config.go index 28d422d712..f2c0b525f6 100644 --- a/cmd/XDC/config.go +++ b/cmd/XDC/config.go @@ -88,8 +88,19 @@ type Bootnodes struct { Testnet []string } +// whisper has been deprecated, but clients out there might still have [Shh] +// in their config, which will crash. Cut them some slack by keeping the +// config, and displaying a message that those config switches are ineffectual. +// To be removed circa Q1 2021 -- @gballet. +type whisperDeprecatedConfig struct { + MaxMessageSize uint32 `toml:",omitempty"` + MinimumAcceptedPOW float64 `toml:",omitempty"` + RestrictConnectionBetweenLightClients bool `toml:",omitempty"` +} + type XDCConfig struct { Eth ethconfig.Config + Shh whisperDeprecatedConfig Node node.Config Ethstats ethstatsConfig XDCX XDCx.Config @@ -139,6 +150,10 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) { if err := loadConfig(file, &cfg); err != nil { utils.Fatalf("%v", err) } + + if cfg.Shh != (whisperDeprecatedConfig{}) { + log.Warn("Deprecated whisper config detected. Whisper has been moved to github.com/ethereum/whisper") + } } if ctx.GlobalIsSet(utils.StakingEnabledFlag.Name) { cfg.StakeEnable = ctx.GlobalBool(utils.StakingEnabledFlag.Name)