whisper: bugfix, saving own messages

This commit is contained in:
Vlad 2017-01-17 19:47:33 +01:00
parent 843c1d9127
commit b702561e87

View file

@ -350,9 +350,6 @@ func (wh *Whisper) runMessageLoop(p *Peer, rw p2p.MsgReadWriter) error {
return fmt.Errorf("invalid envelope") return fmt.Errorf("invalid envelope")
} }
p.mark(envelope) p.mark(envelope)
if wh.mailServer != nil {
wh.mailServer.Archive(envelope)
}
} }
case p2pCode: case p2pCode:
// peer-to-peer message, sent directly to peer bypassing PoW checks, etc. // peer-to-peer message, sent directly to peer bypassing PoW checks, etc.
@ -454,6 +451,9 @@ func (wh *Whisper) add(envelope *Envelope) error {
} else { } else {
glog.V(logger.Detail).Infof("cached whisper envelope [%x]: %v\n", envelope.Hash(), envelope) glog.V(logger.Detail).Infof("cached whisper envelope [%x]: %v\n", envelope.Hash(), envelope)
wh.postEvent(envelope, false) // notify the local node about the new message wh.postEvent(envelope, false) // notify the local node about the new message
if wh.mailServer != nil {
wh.mailServer.Archive(envelope)
}
} }
return nil return nil
} }