cmd: retire whisper flags (#22421)

This commit is contained in:
JukLee0ira 2024-11-13 11:42:32 +08:00
parent cfb72501bf
commit 85ede14a92
5 changed files with 2 additions and 62 deletions

View file

@ -46,7 +46,7 @@ var (
Name: "dumpconfig",
Usage: "Show configuration values",
ArgsUsage: "",
Flags: append(append(nodeFlags, rpcFlags...), whisperFlags...),
Flags: append(nodeFlags, rpcFlags...),
Category: "MISCELLANEOUS COMMANDS",
Description: `The dumpconfig command shows configuration values.`,
}
@ -88,19 +88,8 @@ 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
@ -150,10 +139,6 @@ 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)
@ -224,7 +209,6 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
cfg.Ethstats.URL = ctx.GlobalString(utils.EthStatsURLFlag.Name)
}
utils.SetShhConfig(ctx, stack)
utils.SetXDCXConfig(ctx, &cfg.XDCX, cfg.Node.DataDir)
return stack, cfg
}
@ -242,15 +226,6 @@ func applyValues(values []string, params *[]string) {
}
// checkWhisper returns true in case one of the whisper flags is set.
func checkWhisper(ctx *cli.Context) {
for _, flag := range whisperFlags {
if ctx.GlobalIsSet(flag.GetName()) {
log.Warn("deprecated whisper flag detected. Whisper has been moved to github.com/ethereum/whisper")
}
}
}
func makeFullNode(ctx *cli.Context) (*node.Node, XDCConfig) {
stack, cfg := makeConfigNode(ctx)
@ -259,7 +234,6 @@ func makeFullNode(ctx *cli.Context) (*node.Node, XDCConfig) {
utils.RegisterXDCXService(stack, &cfg.XDCX)
utils.RegisterEthService(stack, &cfg.Eth)
checkWhisper(ctx)
// Add the Ethereum Stats daemon if requested.
if cfg.Ethstats.URL != "" {
utils.RegisterEthStatsService(stack, cfg.Ethstats.URL)

View file

@ -38,7 +38,7 @@ var (
Action: utils.MigrateFlags(localConsole),
Name: "console",
Usage: "Start an interactive JavaScript environment",
Flags: append(append(append(nodeFlags, rpcFlags...), consoleFlags...), whisperFlags...),
Flags: append(append(nodeFlags, rpcFlags...), consoleFlags...),
Category: "CONSOLE COMMANDS",
Description: `
The XDC console is an interactive shell for the JavaScript runtime environment

View file

@ -160,12 +160,6 @@ var (
utils.IPCPathFlag,
utils.RPCGlobalTxFeeCap,
}
whisperFlags = []cli.Flag{
utils.WhisperEnabledFlag,
utils.WhisperMaxMessageSizeFlag,
utils.WhisperMinPOWFlag,
}
)
func init() {
@ -198,7 +192,6 @@ func init() {
app.Flags = append(app.Flags, rpcFlags...)
app.Flags = append(app.Flags, consoleFlags...)
app.Flags = append(app.Flags, debug.Flags...)
app.Flags = append(app.Flags, whisperFlags...)
app.Before = func(ctx *cli.Context) error {
runtime.GOMAXPROCS(runtime.NumCPU())

View file

@ -217,10 +217,6 @@ var AppHelpFlagGroups = []flagGroup{
//utils.NoCompactionFlag,
}, debug.Flags...),
},
//{
// Name: "WHISPER (deprecated)",
// Flags: whisperFlags,
//},
{
Name: "DEPRECATED",
Flags: []cli.Flag{

View file

@ -590,20 +590,6 @@ var (
Usage: "Gas price below which gpo will ignore transactions",
Value: ethconfig.Defaults.GPO.IgnorePrice.Int64(),
}
WhisperEnabledFlag = cli.BoolFlag{
Name: "shh",
Usage: "Enable Whisper",
}
WhisperMaxMessageSizeFlag = cli.IntFlag{
Name: "shh.maxmessagesize",
Usage: "Max message size accepted",
Value: 1024 * 1024,
}
WhisperMinPOWFlag = cli.Float64Flag{
Name: "shh.pow",
Usage: "Minimum POW accepted",
Value: 0.2,
}
XDCXDataDirFlag = DirectoryFlag{
Name: "XDCx.datadir",
Usage: "Data directory for the XDCX databases",
@ -1143,15 +1129,6 @@ func checkExclusive(ctx *cli.Context, args ...interface{}) {
}
}
// SetShhConfig applies shh-related command line flags to the config.
func SetShhConfig(ctx *cli.Context, stack *node.Node) {
if ctx.GlobalIsSet(WhisperEnabledFlag.Name) ||
ctx.GlobalIsSet(WhisperMaxMessageSizeFlag.Name) ||
ctx.GlobalIsSet(WhisperMinPOWFlag.Name) {
log.Warn("Whisper support has been deprecated and the code has been moved to github.com/ethereum/whisper")
}
}
func SetXDCXConfig(ctx *cli.Context, cfg *XDCx.Config, XDCDataDir string) {
if ctx.GlobalIsSet(XDCXDataDirFlag.Name) {
cfg.DataDir = ctx.GlobalString(XDCXDataDirFlag.Name)