aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisper.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-16 00:14:02 +0800
committerobscuren <geffobscura@gmail.com>2014-12-16 00:14:02 +0800
commit01a6db93241a01e98a0467b628423c9b5b1361cb (patch)
treedefc185c17bd88e32c021748ba7a19748496dac7 /whisper/whisper.go
parent993280ec03a8bd8e108da7e222c98efa8482084b (diff)
downloadgo-tangerine-01a6db93241a01e98a0467b628423c9b5b1361cb.tar
go-tangerine-01a6db93241a01e98a0467b628423c9b5b1361cb.tar.gz
go-tangerine-01a6db93241a01e98a0467b628423c9b5b1361cb.tar.bz2
go-tangerine-01a6db93241a01e98a0467b628423c9b5b1361cb.tar.lz
go-tangerine-01a6db93241a01e98a0467b628423c9b5b1361cb.tar.xz
go-tangerine-01a6db93241a01e98a0467b628423c9b5b1361cb.tar.zst
go-tangerine-01a6db93241a01e98a0467b628423c9b5b1361cb.zip
Added whisper debug interface + whisper fixes
Diffstat (limited to 'whisper/whisper.go')
-rw-r--r--whisper/whisper.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/whisper/whisper.go b/whisper/whisper.go
index 1b3f54b67..f91b61d9a 100644
--- a/whisper/whisper.go
+++ b/whisper/whisper.go
@@ -4,6 +4,7 @@ import (
"bytes"
"crypto/ecdsa"
"errors"
+ "fmt"
"sync"
"time"
@@ -71,16 +72,6 @@ func New() *Whisper {
}
whisper.filters.Start()
- // XXX TODO REMOVE TESTING CODE
- //msg := NewMessage([]byte(fmt.Sprintf("Hello world. This is whisper-go. Incase you're wondering; the time is %v", time.Now())))
- //envelope, _ := msg.Seal(DefaultPow, Opts{
- // Ttl: DefaultTtl,
- //})
- //if err := whisper.Send(envelope); err != nil {
- // fmt.Println(err)
- //}
- // XXX TODO REMOVE TESTING CODE
-
// p2p whisper sub protocol handler
whisper.protocol = p2p.Protocol{
Name: "shh",
@@ -158,6 +149,7 @@ func (self *Whisper) msgHandler(peer *p2p.Peer, ws p2p.MsgReadWriter) error {
continue
}
+ fmt.Println("recv")
if err := self.add(envelope); err != nil {
// TODO Punish peer here. Invalid envelope.
peer.Infoln(err)
@@ -184,6 +176,7 @@ func (self *Whisper) add(envelope *Envelope) error {
if !self.expiry[envelope.Expiry].Has(hash) {
self.expiry[envelope.Expiry].Add(hash)
self.postEvent(envelope)
+ fmt.Println("envelope added", envelope)
}
return nil