From 05b1ec008b771d9856e83a6269a5267eb18e1f51 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 18 Feb 2015 11:42:01 +0100 Subject: [PATCH] Disabled ability to disable whisper. Closes #334 --- cmd/ethereum/flags.go | 2 +- cmd/ethereum/main.go | 2 +- cmd/mist/main.go | 1 + eth/backend.go | 6 +++++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go index 1e6869a69..577bee442 100644 --- a/cmd/ethereum/flags.go +++ b/cmd/ethereum/flags.go @@ -132,7 +132,7 @@ func Init() { natstr = flag.String("nat", "any", "port mapping mechanism (any|none|upnp|pmp|extip:)") ) flag.BoolVar(&Dial, "dial", true, "dial out connections (default on)") - flag.BoolVar(&SHH, "shh", true, "run whisper protocol (default on)") + //flag.BoolVar(&SHH, "shh", true, "run whisper protocol (default on)") flag.StringVar(&OutboundPort, "port", "30303", "listening port") flag.StringVar(&BootNodes, "bootnodes", "", "space-separated node URLs for discovery bootstrap") diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 0dba462be..1ffd4b6e9 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -71,7 +71,7 @@ func main() { Port: OutboundPort, NAT: NAT, KeyRing: KeyRing, - Shh: SHH, + Shh: true, Dial: Dial, BootNodes: BootNodes, NodeKey: NodeKey, diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 32222fbef..14f561e99 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -60,6 +60,7 @@ func run() error { MaxPeers: MaxPeer, Port: OutboundPort, NAT: NAT, + Shh: true, BootNodes: BootNodes, NodeKey: NodeKey, KeyRing: KeyRing, diff --git a/eth/backend.go b/eth/backend.go index 690c7136d..d109ab98e 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -160,7 +160,11 @@ func New(config *Config) (*Ethereum, error) { eth.blockPool = NewBlockPool(hasBlock, insertChain, ezp.Verify) ethProto := EthProtocol(eth.txPool, eth.chainManager, eth.blockPool) - protocols := []p2p.Protocol{ethProto, eth.whisper.Protocol()} + protocols := []p2p.Protocol{ethProto} + if config.Shh { + protocols = append(protocols, eth.whisper.Protocol()) + } + netprv := config.NodeKey if netprv == nil { if netprv, err = crypto.GenerateKey(); err != nil {