diff options
author | Bas van Kervel <basvankervel@gmail.com> | 2017-06-13 17:49:07 +0800 |
---|---|---|
committer | Bas van Kervel <basvankervel@gmail.com> | 2017-06-15 17:53:15 +0800 |
commit | b58a5016738b92db19e08ec87ef34ce3250fae6b (patch) | |
tree | fa9485b3f711204b14edae5dcbc812e624490c68 /cmd/utils | |
parent | 80f7c6c2996ad47f70a5070c400b1fd87a20c59c (diff) | |
download | dexon-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar dexon-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar.gz dexon-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar.bz2 dexon-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar.lz dexon-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar.xz dexon-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar.zst dexon-b58a5016738b92db19e08ec87ef34ce3250fae6b.zip |
whisperv5: integrate whisper and add whisper RPC simulator
Diffstat (limited to 'cmd/utils')
-rw-r--r-- | cmd/utils/flags.go | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 3c97cd3bb..095a9f62c 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -440,11 +440,6 @@ var ( Usage: "Restricts network communication to the given IP networks (CIDR masks)", } - WhisperEnabledFlag = cli.BoolFlag{ - Name: "shh", - Usage: "Enable Whisper", - } - // ATM the url is left to the user and deployment to JSpathFlag = cli.StringFlag{ Name: "jspath", @@ -878,6 +873,16 @@ func checkExclusive(ctx *cli.Context, flags ...cli.Flag) { } } +// SetShhConfig applies shh-related command line flags to the config. +func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) { + if ctx.GlobalIsSet(whisper.MaxMessageSizeFlag.Name) { + cfg.MaxMessageSize = uint32(ctx.GlobalUint(whisper.MaxMessageSizeFlag.Name)) + } + if ctx.GlobalIsSet(whisper.MinPOWFlag.Name) { + cfg.MinimumAcceptedPOW = ctx.GlobalFloat64(whisper.MinPOWFlag.Name) + } +} + // SetEthConfig applies eth-related command line flags to the config. func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { // Avoid conflicting network flags @@ -983,8 +988,10 @@ func RegisterEthService(stack *node.Node, cfg *eth.Config) { } // RegisterShhService configures Whisper and adds it to the given node. -func RegisterShhService(stack *node.Node) { - if err := stack.Register(func(*node.ServiceContext) (node.Service, error) { return whisper.New(), nil }); err != nil { +func RegisterShhService(stack *node.Node, cfg *whisper.Config) { + if err := stack.Register(func(n *node.ServiceContext) (node.Service, error) { + return whisper.New(cfg), nil + }); err != nil { Fatalf("Failed to register the Whisper service: %v", err) } } |