aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/server_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-02-27 11:06:55 +0800
committerFelix Lange <fjl@twurst.com>2015-03-04 19:27:23 +0800
commit736e632215d49dd7bc61126f78dda4bad12768ea (patch)
tree063327c533fd57620e0448f331832e79f9ba0dda /p2p/server_test.go
parent51e01cceca81bc5e82896815754b7c33bb6e6005 (diff)
downloadgo-tangerine-736e632215d49dd7bc61126f78dda4bad12768ea.tar.gz
go-tangerine-736e632215d49dd7bc61126f78dda4bad12768ea.tar.zst
go-tangerine-736e632215d49dd7bc61126f78dda4bad12768ea.zip
p2p: use RLPx frames for messaging
Diffstat (limited to 'p2p/server_test.go')
-rw-r--r--p2p/server_test.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/p2p/server_test.go b/p2p/server_test.go
index c109fffb9..c348f5a9a 100644
--- a/p2p/server_test.go
+++ b/p2p/server_test.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/crypto"
+ "github.com/ethereum/go-ethereum/crypto/sha3"
"github.com/ethereum/go-ethereum/p2p/discover"
)
@@ -23,8 +24,14 @@ func startTestServer(t *testing.T, pf newPeerHook) *Server {
newPeerHook: pf,
setupFunc: func(fd net.Conn, prv *ecdsa.PrivateKey, our *protoHandshake, dial *discover.Node) (*conn, error) {
id := randomID()
+ rw := newRlpxFrameRW(fd, secrets{
+ MAC: zero16,
+ AES: zero16,
+ IngressMAC: sha3.NewKeccak256(),
+ EgressMAC: sha3.NewKeccak256(),
+ })
return &conn{
- frameRW: newFrameRW(fd, msgWriteTimeout),
+ MsgReadWriter: rw,
protoHandshake: &protoHandshake{ID: id, Version: baseProtocolVersion},
}, nil
},
@@ -143,9 +150,7 @@ func TestServerBroadcast(t *testing.T) {
// broadcast one message
srv.Broadcast("discard", 0, "foo")
- goldbuf := new(bytes.Buffer)
- writeMsg(goldbuf, NewMsg(16, "foo"))
- golden := goldbuf.Bytes()
+ golden := unhex("66e94e166f0a2c3b884cfa59ca34")
// check that the message has been written everywhere
for i, conn := range conns {