just enable by default

This commit is contained in:
obscuren 2015-01-08 22:18:23 +01:00
parent 4a0ade4788
commit 26f066f0c7
2 changed files with 6 additions and 7 deletions

View File

@ -134,24 +134,20 @@ func New(config *Config) (*Ethereum, error) {
eth.blockPool = NewBlockPool(hasBlock, insertChain, ezp.Verify) eth.blockPool = NewBlockPool(hasBlock, insertChain, ezp.Verify)
ethProto := EthProtocol(eth.txPool, eth.chainManager, eth.blockPool) ethProto := EthProtocol(eth.txPool, eth.chainManager, eth.blockPool)
protocols := []p2p.Protocol{ethProto} protocols := []p2p.Protocol{ethProto, eth.whisper.Protocol()}
if config.Shh {
eth.whisper = whisper.New()
protocols = append(protocols, eth.whisper.Protocol())
}
nat, err := p2p.ParseNAT(config.NATType, config.PMPGateway) nat, err := p2p.ParseNAT(config.NATType, config.PMPGateway)
if err != nil { if err != nil {
return nil, err return nil, err
} }
fmt.Println(nat)
eth.net = &p2p.Server{ eth.net = &p2p.Server{
Identity: clientId, Identity: clientId,
MaxPeers: config.MaxPeers, MaxPeers: config.MaxPeers,
Protocols: protocols, Protocols: protocols,
Blacklist: eth.blacklist, Blacklist: eth.blacklist,
NAT: nat, NAT: p2p.UPNP(),
NoDial: !config.Dial, NoDial: !config.Dial,
} }

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"crypto/ecdsa" "crypto/ecdsa"
"errors" "errors"
"fmt"
"sync" "sync"
"time" "time"
@ -143,6 +144,7 @@ func (self *Whisper) msgHandler(peer *p2p.Peer, ws p2p.MsgReadWriter) error {
if err != nil { if err != nil {
return err return err
} }
fmt.Println("reading message")
envelope, err := NewEnvelopeFromReader(msg.Payload) envelope, err := NewEnvelopeFromReader(msg.Payload)
if err != nil { 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. // 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 { func (self *Whisper) add(envelope *Envelope) error {
fmt.Println("adding")
if !envelope.valid() { if !envelope.valid() {
return errors.New("invalid pow provided for envelope") return errors.New("invalid pow provided for envelope")
} }