diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-09 04:41:32 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-09 04:41:32 +0800 |
commit | 4a0ade4788b0e8d53c6b0eabaf9652643b6a073a (patch) | |
tree | 57a477ec1419547130ca75638fb2df71f883b4f4 /ui | |
parent | 5f958a582d1326ada1cb34b4c6578590a7c40e6c (diff) | |
download | dexon-4a0ade4788b0e8d53c6b0eabaf9652643b6a073a.tar.gz dexon-4a0ade4788b0e8d53c6b0eabaf9652643b6a073a.tar.zst dexon-4a0ade4788b0e8d53c6b0eabaf9652643b6a073a.zip |
Fixed some whisper issues
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/qwhisper/whisper.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/qt/qwhisper/whisper.go b/ui/qt/qwhisper/whisper.go index 0627acd29..8a064c81c 100644 --- a/ui/qt/qwhisper/whisper.go +++ b/ui/qt/qwhisper/whisper.go @@ -6,10 +6,13 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/whisper" "gopkg.in/qml.v1" ) +var qlogger = logger.NewLogger("QSHH") + func fromHex(s string) []byte { if len(s) > 1 { return ethutil.Hex2Bytes(s[2:]) @@ -36,9 +39,10 @@ func (self *Whisper) SetView(view qml.Object) { func (self *Whisper) Post(payload []string, to, from string, topics []string, priority, ttl uint32) { var data []byte for _, d := range payload { - data = append(data, fromHex(d)...) + data = append(data, ethutil.Hex2Bytes(d)...) } + fmt.Println(payload, data, "from", from, fromHex(from), crypto.ToECDSA(fromHex(from))) msg := whisper.NewMessage(data) envelope, err := msg.Seal(time.Duration(priority*100000), whisper.Opts{ Ttl: time.Duration(ttl), @@ -47,13 +51,13 @@ func (self *Whisper) Post(payload []string, to, from string, topics []string, pr Topics: whisper.TopicsFromString(topics...), }) if err != nil { - fmt.Println(err) + qlogger.Infoln(err) // handle error return } if err := self.Whisper.Send(envelope); err != nil { - fmt.Println(err) + qlogger.Infoln(err) // handle error return } |