소스 검색

just enable by default

obscuren 10 년 전
부모
커밋
26f066f0c7
2개의 변경된 파일6개의 추가작업 그리고 7개의 파일을 삭제
  1. 3 7
      eth/backend.go
  2. 3 0
      whisper/whisper.go

+ 3 - 7
eth/backend.go

@@ -134,24 +134,20 @@ 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}
-
-	if config.Shh {
-		eth.whisper = whisper.New()
-		protocols = append(protocols, eth.whisper.Protocol())
-	}
+	protocols := []p2p.Protocol{ethProto, eth.whisper.Protocol()}
 
 	nat, err := p2p.ParseNAT(config.NATType, config.PMPGateway)
 	if err != nil {
 		return nil, err
 	}
+	fmt.Println(nat)
 
 	eth.net = &p2p.Server{
 		Identity:  clientId,
 		MaxPeers:  config.MaxPeers,
 		Protocols: protocols,
 		Blacklist: eth.blacklist,
-		NAT:       nat,
+		NAT:       p2p.UPNP(),
 		NoDial:    !config.Dial,
 	}
 

+ 3 - 0
whisper/whisper.go

@@ -4,6 +4,7 @@ import (
 	"bytes"
 	"crypto/ecdsa"
 	"errors"
+	"fmt"
 	"sync"
 	"time"
 
@@ -143,6 +144,7 @@ func (self *Whisper) msgHandler(peer *p2p.Peer, ws p2p.MsgReadWriter) error {
 		if err != nil {
 			return err
 		}
+		fmt.Println("reading message")
 
 		envelope, err := NewEnvelopeFromReader(msg.Payload)
 		if err != nil {
@@ -160,6 +162,7 @@ func (self *Whisper) msgHandler(peer *p2p.Peer, ws p2p.MsgReadWriter) error {
 
 // takes care of adding envelopes to the messages pool. At this moment no sanity checks are being performed.
 func (self *Whisper) add(envelope *Envelope) error {
+	fmt.Println("adding")
 	if !envelope.valid() {
 		return errors.New("invalid pow provided for envelope")
 	}