Selaa lähdekoodia

Disabled ability to disable whisper. Closes #334

obscuren 10 vuotta sitten
vanhempi
commit
05b1ec008b
4 muutettua tiedostoa jossa 8 lisäystä ja 3 poistoa
  1. 1 1
      cmd/ethereum/flags.go
  2. 1 1
      cmd/ethereum/main.go
  3. 1 0
      cmd/mist/main.go
  4. 5 1
      eth/backend.go

+ 1 - 1
cmd/ethereum/flags.go

@@ -132,7 +132,7 @@ func Init() {
 		natstr      = flag.String("nat", "any", "port mapping mechanism (any|none|upnp|pmp|extip:<IP>)")
 	)
 	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")

+ 1 - 1
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,

+ 1 - 0
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,

+ 5 - 1
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 {