Skip to content

Commit 6459d0c

Browse files
authored
Merge pull request #687 from JukLee0ira/whisper
whisper: remove package whisper
2 parents 5316e9b + 85ede14 commit 6459d0c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2
-13490
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ les/ @zsfelfoldi
99
light/ @zsfelfoldi
1010
mobile/ @karalabe
1111
p2p/ @fjl @zsfelfoldi
12-
whisper/ @gballet @gluk256

cmd/XDC/config.go

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737
"github.com/XinFinOrg/XDPoSChain/log"
3838
"github.com/XinFinOrg/XDPoSChain/node"
3939
"github.com/XinFinOrg/XDPoSChain/params"
40-
whisper "github.com/XinFinOrg/XDPoSChain/whisper/whisperv6"
4140
"github.com/naoina/toml"
4241
)
4342

@@ -47,7 +46,7 @@ var (
4746
Name: "dumpconfig",
4847
Usage: "Show configuration values",
4948
ArgsUsage: "",
50-
Flags: append(append(nodeFlags, rpcFlags...), whisperFlags...),
49+
Flags: append(nodeFlags, rpcFlags...),
5150
Category: "MISCELLANEOUS COMMANDS",
5251
Description: `The dumpconfig command shows configuration values.`,
5352
}
@@ -91,7 +90,6 @@ type Bootnodes struct {
9190

9291
type XDCConfig struct {
9392
Eth ethconfig.Config
94-
Shh whisper.Config
9593
Node node.Config
9694
Ethstats ethstatsConfig
9795
XDCX XDCx.Config
@@ -130,7 +128,6 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
130128
// Load defaults.
131129
cfg := XDCConfig{
132130
Eth: ethconfig.Defaults,
133-
Shh: whisper.DefaultConfig,
134131
XDCX: XDCx.DefaultConfig,
135132
Node: defaultNodeConfig(),
136133
StakeEnable: true,
@@ -212,7 +209,6 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
212209
cfg.Ethstats.URL = ctx.GlobalString(utils.EthStatsURLFlag.Name)
213210
}
214211

215-
utils.SetShhConfig(ctx, stack, &cfg.Shh)
216212
utils.SetXDCXConfig(ctx, &cfg.XDCX, cfg.Node.DataDir)
217213
return stack, cfg
218214
}
@@ -230,16 +226,6 @@ func applyValues(values []string, params *[]string) {
230226

231227
}
232228

233-
// enableWhisper returns true in case one of the whisper flags is set.
234-
func enableWhisper(ctx *cli.Context) bool {
235-
for _, flag := range whisperFlags {
236-
if ctx.GlobalIsSet(flag.GetName()) {
237-
return true
238-
}
239-
}
240-
return false
241-
}
242-
243229
func makeFullNode(ctx *cli.Context) (*node.Node, XDCConfig) {
244230
stack, cfg := makeConfigNode(ctx)
245231

@@ -248,19 +234,6 @@ func makeFullNode(ctx *cli.Context) (*node.Node, XDCConfig) {
248234
utils.RegisterXDCXService(stack, &cfg.XDCX)
249235
utils.RegisterEthService(stack, &cfg.Eth)
250236

251-
// Whisper must be explicitly enabled by specifying at least 1 whisper flag or in dev mode
252-
shhEnabled := enableWhisper(ctx)
253-
shhAutoEnabled := !ctx.GlobalIsSet(utils.WhisperEnabledFlag.Name) && ctx.GlobalIsSet(utils.DeveloperFlag.Name)
254-
if shhEnabled || shhAutoEnabled {
255-
if ctx.GlobalIsSet(utils.WhisperMaxMessageSizeFlag.Name) {
256-
cfg.Shh.MaxMessageSize = uint32(ctx.Int(utils.WhisperMaxMessageSizeFlag.Name))
257-
}
258-
if ctx.GlobalIsSet(utils.WhisperMinPOWFlag.Name) {
259-
cfg.Shh.MinimumAcceptedPOW = ctx.Float64(utils.WhisperMinPOWFlag.Name)
260-
}
261-
utils.RegisterShhService(stack, &cfg.Shh)
262-
}
263-
264237
// Add the Ethereum Stats daemon if requested.
265238
if cfg.Ethstats.URL != "" {
266239
utils.RegisterEthStatsService(stack, cfg.Ethstats.URL)

cmd/XDC/consolecmd.go

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

cmd/XDC/main.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,6 @@ var (
160160
utils.IPCPathFlag,
161161
utils.RPCGlobalTxFeeCap,
162162
}
163-
164-
whisperFlags = []cli.Flag{
165-
utils.WhisperEnabledFlag,
166-
utils.WhisperMaxMessageSizeFlag,
167-
utils.WhisperMinPOWFlag,
168-
}
169163
)
170164

171165
func init() {
@@ -198,7 +192,6 @@ func init() {
198192
app.Flags = append(app.Flags, rpcFlags...)
199193
app.Flags = append(app.Flags, consoleFlags...)
200194
app.Flags = append(app.Flags, debug.Flags...)
201-
app.Flags = append(app.Flags, whisperFlags...)
202195

203196
app.Before = func(ctx *cli.Context) error {
204197
runtime.GOMAXPROCS(runtime.NumCPU())

cmd/XDC/usage.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,6 @@ var AppHelpFlagGroups = []flagGroup{
217217
//utils.NoCompactionFlag,
218218
}, debug.Flags...),
219219
},
220-
//{
221-
// Name: "WHISPER (EXPERIMENTAL)",
222-
// Flags: whisperFlags,
223-
//},
224220
{
225221
Name: "DEPRECATED",
226222
Flags: []cli.Flag{

cmd/utils/flags.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ import (
5858
"github.com/XinFinOrg/XDPoSChain/p2p/netutil"
5959
"github.com/XinFinOrg/XDPoSChain/params"
6060
"github.com/XinFinOrg/XDPoSChain/rpc"
61-
whisper "github.com/XinFinOrg/XDPoSChain/whisper/whisperv6"
6261
gopsutil "github.com/shirou/gopsutil/mem"
6362
"gopkg.in/urfave/cli.v1"
6463
)
@@ -591,20 +590,6 @@ var (
591590
Usage: "Gas price below which gpo will ignore transactions",
592591
Value: ethconfig.Defaults.GPO.IgnorePrice.Int64(),
593592
}
594-
WhisperEnabledFlag = cli.BoolFlag{
595-
Name: "shh",
596-
Usage: "Enable Whisper",
597-
}
598-
WhisperMaxMessageSizeFlag = cli.IntFlag{
599-
Name: "shh.maxmessagesize",
600-
Usage: "Max message size accepted",
601-
Value: int(whisper.DefaultMaxMessageSize),
602-
}
603-
WhisperMinPOWFlag = cli.Float64Flag{
604-
Name: "shh.pow",
605-
Usage: "Minimum POW accepted",
606-
Value: whisper.DefaultMinimumPoW,
607-
}
608593
XDCXDataDirFlag = DirectoryFlag{
609594
Name: "XDCx.datadir",
610595
Usage: "Data directory for the XDCX databases",
@@ -1144,16 +1129,6 @@ func checkExclusive(ctx *cli.Context, args ...interface{}) {
11441129
}
11451130
}
11461131

1147-
// SetShhConfig applies shh-related command line flags to the config.
1148-
func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) {
1149-
if ctx.GlobalIsSet(WhisperMaxMessageSizeFlag.Name) {
1150-
cfg.MaxMessageSize = uint32(ctx.GlobalUint(WhisperMaxMessageSizeFlag.Name))
1151-
}
1152-
if ctx.GlobalIsSet(WhisperMinPOWFlag.Name) {
1153-
cfg.MinimumAcceptedPOW = ctx.GlobalFloat64(WhisperMinPOWFlag.Name)
1154-
}
1155-
}
1156-
11571132
func SetXDCXConfig(ctx *cli.Context, cfg *XDCx.Config, XDCDataDir string) {
11581133
if ctx.GlobalIsSet(XDCXDataDirFlag.Name) {
11591134
cfg.DataDir = ctx.GlobalString(XDCXDataDirFlag.Name)

cmd/utils/utils.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/XinFinOrg/XDPoSChain/ethstats"
1010
"github.com/XinFinOrg/XDPoSChain/les"
1111
"github.com/XinFinOrg/XDPoSChain/node"
12-
whisper "github.com/XinFinOrg/XDPoSChain/whisper/whisperv6"
1312
)
1413

1514
// RegisterEthService adds an Ethereum client to the stack.
@@ -38,15 +37,6 @@ func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) {
3837
}
3938
}
4039

41-
// RegisterShhService configures Whisper and adds it to the given node.
42-
func RegisterShhService(stack *node.Node, cfg *whisper.Config) {
43-
if err := stack.Register(func(n *node.ServiceContext) (node.Service, error) {
44-
return whisper.New(cfg), nil
45-
}); err != nil {
46-
Fatalf("Failed to register the Whisper service: %v", err)
47-
}
48-
}
49-
5040
// RegisterEthStatsService configures the Ethereum Stats daemon and adds it to the node.
5141
func RegisterEthStatsService(stack *node.Node, url string) {
5242
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {

0 commit comments

Comments
 (0)