Skip to content

Commit 5a81dd9

Browse files
authored
cmd: retire whisper flags (#22421)
* cmd: retire whisper flags * cmd/geth: remove whisper configs
1 parent b24804d commit 5a81dd9

File tree

5 files changed

+3
-70
lines changed

5 files changed

+3
-70
lines changed

cmd/geth/config.go

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
"github.com/ethereum/go-ethereum/cmd/utils"
3131
"github.com/ethereum/go-ethereum/eth/ethconfig"
3232
"github.com/ethereum/go-ethereum/internal/ethapi"
33-
"github.com/ethereum/go-ethereum/log"
3433
"github.com/ethereum/go-ethereum/metrics"
3534
"github.com/ethereum/go-ethereum/node"
3635
"github.com/ethereum/go-ethereum/params"
@@ -43,7 +42,7 @@ var (
4342
Name: "dumpconfig",
4443
Usage: "Show configuration values",
4544
ArgsUsage: "",
46-
Flags: append(append(nodeFlags, rpcFlags...), whisperFlags...),
45+
Flags: append(nodeFlags, rpcFlags...),
4746
Category: "MISCELLANEOUS COMMANDS",
4847
Description: `The dumpconfig command shows configuration values.`,
4948
}
@@ -75,19 +74,8 @@ type ethstatsConfig struct {
7574
URL string `toml:",omitempty"`
7675
}
7776

78-
// whisper has been deprecated, but clients out there might still have [Shh]
79-
// in their config, which will crash. Cut them some slack by keeping the
80-
// config, and displaying a message that those config switches are ineffectual.
81-
// To be removed circa Q1 2021 -- @gballet.
82-
type whisperDeprecatedConfig struct {
83-
MaxMessageSize uint32 `toml:",omitempty"`
84-
MinimumAcceptedPOW float64 `toml:",omitempty"`
85-
RestrictConnectionBetweenLightClients bool `toml:",omitempty"`
86-
}
87-
8877
type gethConfig struct {
8978
Eth ethconfig.Config
90-
Shh whisperDeprecatedConfig
9179
Node node.Config
9280
Ethstats ethstatsConfig
9381
Metrics metrics.Config
@@ -132,11 +120,8 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
132120
if err := loadConfig(file, &cfg); err != nil {
133121
utils.Fatalf("%v", err)
134122
}
135-
136-
if cfg.Shh != (whisperDeprecatedConfig{}) {
137-
log.Warn("Deprecated whisper config detected. Whisper has been moved to github.com/ethereum/whisper")
138-
}
139123
}
124+
140125
// Apply flags.
141126
utils.SetNodeConfig(ctx, &cfg.Node)
142127
stack, err := node.New(&cfg.Node)
@@ -147,22 +132,11 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
147132
if ctx.GlobalIsSet(utils.EthStatsURLFlag.Name) {
148133
cfg.Ethstats.URL = ctx.GlobalString(utils.EthStatsURLFlag.Name)
149134
}
150-
utils.SetShhConfig(ctx, stack)
151-
152135
applyMetricConfig(ctx, &cfg)
153136

154137
return stack, cfg
155138
}
156139

157-
// enableWhisper returns true in case one of the whisper flags is set.
158-
func checkWhisper(ctx *cli.Context) {
159-
for _, flag := range whisperFlags {
160-
if ctx.GlobalIsSet(flag.GetName()) {
161-
log.Warn("deprecated whisper flag detected. Whisper has been moved to github.com/ethereum/whisper")
162-
}
163-
}
164-
}
165-
166140
// makeFullNode loads geth configuration and creates the Ethereum backend.
167141
func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
168142
stack, cfg := makeConfigNode(ctx)
@@ -171,7 +145,6 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
171145
}
172146
backend := utils.RegisterEthService(stack, &cfg.Eth)
173147

174-
checkWhisper(ctx)
175148
// Configure GraphQL if requested
176149
if ctx.GlobalIsSet(utils.GraphQLEnabledFlag.Name) {
177150
utils.RegisterGraphQLService(stack, backend, cfg.Node)

cmd/geth/consolecmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var (
3636
Action: utils.MigrateFlags(localConsole),
3737
Name: "console",
3838
Usage: "Start an interactive JavaScript environment",
39-
Flags: append(append(append(nodeFlags, rpcFlags...), consoleFlags...), whisperFlags...),
39+
Flags: append(append(nodeFlags, rpcFlags...), consoleFlags...),
4040
Category: "CONSOLE COMMANDS",
4141
Description: `
4242
The Geth console is an interactive shell for the JavaScript runtime environment

cmd/geth/main.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,6 @@ var (
186186
utils.AllowUnprotectedTxs,
187187
}
188188

189-
whisperFlags = []cli.Flag{
190-
utils.WhisperEnabledFlag,
191-
utils.WhisperMaxMessageSizeFlag,
192-
utils.WhisperMinPOWFlag,
193-
utils.WhisperRestrictConnectionBetweenLightClientsFlag,
194-
}
195-
196189
metricsFlags = []cli.Flag{
197190
utils.MetricsEnabledFlag,
198191
utils.MetricsEnabledExpensiveFlag,
@@ -251,7 +244,6 @@ func init() {
251244
app.Flags = append(app.Flags, rpcFlags...)
252245
app.Flags = append(app.Flags, consoleFlags...)
253246
app.Flags = append(app.Flags, debug.Flags...)
254-
app.Flags = append(app.Flags, whisperFlags...)
255247
app.Flags = append(app.Flags, metricsFlags...)
256248

257249
app.Before = func(ctx *cli.Context) error {

cmd/geth/usage.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,6 @@ var AppHelpFlagGroups = []flags.FlagGroup{
216216
Name: "METRICS AND STATS",
217217
Flags: metricsFlags,
218218
},
219-
{
220-
Name: "WHISPER (deprecated)",
221-
Flags: whisperFlags,
222-
},
223219
{
224220
Name: "ALIASED (deprecated)",
225221
Flags: []cli.Flag{

cmd/utils/flags.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -680,24 +680,6 @@ var (
680680
Usage: "Maximum gas price will be recommended by gpo",
681681
Value: ethconfig.Defaults.GPO.MaxPrice.Int64(),
682682
}
683-
WhisperEnabledFlag = cli.BoolFlag{
684-
Name: "shh",
685-
Usage: "Enable Whisper",
686-
}
687-
WhisperMaxMessageSizeFlag = cli.IntFlag{
688-
Name: "shh.maxmessagesize",
689-
Usage: "Max message size accepted",
690-
Value: 1024 * 1024,
691-
}
692-
WhisperMinPOWFlag = cli.Float64Flag{
693-
Name: "shh.pow",
694-
Usage: "Minimum POW accepted",
695-
Value: 0.2,
696-
}
697-
WhisperRestrictConnectionBetweenLightClientsFlag = cli.BoolFlag{
698-
Name: "shh.restrict-light",
699-
Usage: "Restrict connection between two whisper light clients",
700-
}
701683

702684
// Metrics flags
703685
MetricsEnabledFlag = cli.BoolFlag{
@@ -1461,16 +1443,6 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) {
14611443
}
14621444
}
14631445

1464-
// SetShhConfig applies shh-related command line flags to the config.
1465-
func SetShhConfig(ctx *cli.Context, stack *node.Node) {
1466-
if ctx.GlobalIsSet(WhisperEnabledFlag.Name) ||
1467-
ctx.GlobalIsSet(WhisperMaxMessageSizeFlag.Name) ||
1468-
ctx.GlobalIsSet(WhisperMinPOWFlag.Name) ||
1469-
ctx.GlobalIsSet(WhisperRestrictConnectionBetweenLightClientsFlag.Name) {
1470-
log.Warn("Whisper support has been deprecated and the code has been moved to github.com/ethereum/whisper")
1471-
}
1472-
}
1473-
14741446
// SetEthConfig applies eth-related command line flags to the config.
14751447
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
14761448
// Avoid conflicting network flags

0 commit comments

Comments
 (0)