mirror of
https://github.com/status-im/whisper.git
synced 2025-01-20 23:59:21 +00:00
Fixed some whisper issues
This commit is contained in:
parent
6abd465f78
commit
07f13c2a3a
@ -2,6 +2,7 @@ package whisper
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
@ -53,6 +54,7 @@ type Opts struct {
|
||||
}
|
||||
|
||||
func (self *Message) Seal(pow time.Duration, opts Opts) (*Envelope, error) {
|
||||
fmt.Println(opts)
|
||||
if opts.From != nil {
|
||||
err := self.sign(opts.From)
|
||||
if err != nil {
|
||||
|
2
peer.go
2
peer.go
@ -55,7 +55,7 @@ out:
|
||||
case <-relay.C:
|
||||
err := self.broadcast(self.host.envelopes())
|
||||
if err != nil {
|
||||
self.peer.Infoln(err)
|
||||
self.peer.Infoln("broadcast err:", err)
|
||||
break out
|
||||
}
|
||||
|
||||
|
@ -229,11 +229,11 @@ func (self *Whisper) envelopes() (envelopes []*Envelope) {
|
||||
func (self *Whisper) postEvent(envelope *Envelope) {
|
||||
for _, key := range self.keys {
|
||||
if message, err := envelope.Open(key); err == nil || (err != nil && err == ecies.ErrInvalidPublicKey) {
|
||||
// Create a custom filter?
|
||||
self.filters.Notify(filter.Generic{
|
||||
Str1: string(crypto.FromECDSA(key)), Str2: string(crypto.FromECDSAPub(message.Recover())),
|
||||
Data: bytesToMap(envelope.Topics),
|
||||
}, message)
|
||||
break
|
||||
} else {
|
||||
wlogger.Infoln(err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user