mirror of
https://github.com/status-im/whisper.git
synced 2025-02-23 16:08:25 +00:00
eth, whisper: adapt for RLP encoder switch in package p2p
I have rewritten the protocol test to use p2p.MsgPipe because p2p.NewMsg is gone.
This commit is contained in:
parent
9e83aab7e2
commit
e1d7f07e4a
@ -6,9 +6,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/crypto/ecies"
|
"github.com/ethereum/go-ethereum/crypto/ecies"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
9
peer.go
9
peer.go
@ -77,12 +77,11 @@ func (self *peer) broadcast(envelopes []*Envelope) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
if err := p2p.EncodeMsg(self.ws, envelopesMsg, envs[:i]...); err != nil {
|
if err := p2p.Send(self.ws, envelopesMsg, envs[:i]); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
self.peer.DebugDetailln("broadcasted", i, "message(s)")
|
self.peer.DebugDetailln("broadcasted", i, "message(s)")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +91,7 @@ func (self *peer) addKnown(envelope *Envelope) {
|
|||||||
|
|
||||||
func (self *peer) handleStatus() error {
|
func (self *peer) handleStatus() error {
|
||||||
ws := self.ws
|
ws := self.ws
|
||||||
if err := ws.WriteMsg(self.statusMsg()); err != nil {
|
if err := p2p.SendItems(ws, statusMsg, protocolVersion); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
msg, err := ws.ReadMsg()
|
msg, err := ws.ReadMsg()
|
||||||
@ -115,7 +114,3 @@ func (self *peer) handleStatus() error {
|
|||||||
}
|
}
|
||||||
return msg.Discard() // ignore anything after protocol version
|
return msg.Discard() // ignore anything after protocol version
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *peer) statusMsg() p2p.Msg {
|
|
||||||
return p2p.NewMsg(statusMsg, protocolVersion)
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user