whisperv5: fix protocol of whisperv5 envelopes
This commit is contained in:
parent
4d1d5c7912
commit
01d3aa9fe1
|
@ -568,21 +568,18 @@ func (wh *Whisper) runMessageLoop(p *Peer, rw p2p.MsgReadWriter) error {
|
|||
log.Warn("unxepected status message received", "peer", p.peer.ID())
|
||||
case messagesCode:
|
||||
// decode the contained envelopes
|
||||
var envelopes []*Envelope
|
||||
if err := packet.Decode(&envelopes); err != nil {
|
||||
var envelope Envelope
|
||||
if err := packet.Decode(&envelope); err != nil {
|
||||
log.Warn("failed to decode envelope, peer will be disconnected", "peer", p.peer.ID(), "err", err)
|
||||
return errors.New("invalid envelope")
|
||||
}
|
||||
// inject all envelopes into the internal pool
|
||||
for _, envelope := range envelopes {
|
||||
cached, err := wh.add(envelope)
|
||||
cached, err := wh.add(&envelope)
|
||||
if err != nil {
|
||||
log.Warn("bad envelope received, peer will be disconnected", "peer", p.peer.ID(), "err", err)
|
||||
return errors.New("invalid envelope")
|
||||
}
|
||||
if cached {
|
||||
p.mark(envelope)
|
||||
}
|
||||
p.mark(&envelope)
|
||||
}
|
||||
case p2pCode:
|
||||
// peer-to-peer message, sent directly to peer bypassing PoW checks, etc.
|
||||
|
|
Loading…
Reference in New Issue