diff options
author | Felix Lange <fjl@twurst.com> | 2015-03-04 19:03:43 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-03-04 19:27:24 +0800 |
commit | 7964f30dcbdde00b2960ef6e98320e0a0f9300e2 (patch) | |
tree | add3fbd54ec615135f3ecdac2917d22e77581d56 /p2p/rlpx_test.go | |
parent | 21649100b1ed64c9bd73c547360dd6db9b5218fb (diff) | |
download | go-tangerine-7964f30dcbdde00b2960ef6e98320e0a0f9300e2.tar.gz go-tangerine-7964f30dcbdde00b2960ef6e98320e0a0f9300e2.tar.zst go-tangerine-7964f30dcbdde00b2960ef6e98320e0a0f9300e2.zip |
p2p: msg.Payload contains list data
With RLPx frames, the message code is contained in the
frame and is no longer part of the encoded data.
EncodeMsg, Msg.Decode have been updated to match.
Code that decodes RLP directly from Msg.Payload will need
to change.
Diffstat (limited to 'p2p/rlpx_test.go')
-rw-r--r-- | p2p/rlpx_test.go | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/p2p/rlpx_test.go b/p2p/rlpx_test.go index 077dd1309..49354c7ed 100644 --- a/p2p/rlpx_test.go +++ b/p2p/rlpx_test.go @@ -3,8 +3,6 @@ package p2p import ( "bytes" "crypto/rand" - "encoding/hex" - "fmt" "io/ioutil" "strings" "testing" @@ -32,7 +30,7 @@ ba628a4ba590cb43f7848f41c4382885 `) // Check WriteMsg. This puts a message into the buffer. - if err := EncodeMsg(rw, 8, []interface{}{1, 2, 3, 4}); err != nil { + if err := EncodeMsg(rw, 8, 1, 2, 3, 4); err != nil { t.Fatalf("WriteMsg error: %v", err) } written := buf.Bytes() @@ -68,14 +66,6 @@ func (fakeHash) BlockSize() int { return 0 } func (h fakeHash) Size() int { return len(h) } func (h fakeHash) Sum(b []byte) []byte { return append(b, h...) } -func unhex(str string) []byte { - b, err := hex.DecodeString(strings.Replace(str, "\n", "", -1)) - if err != nil { - panic(fmt.Sprintf("invalid hex string: %q", str)) - } - return b -} - func TestRlpxFrameRW(t *testing.T) { var ( aesSecret = make([]byte, 16) @@ -112,7 +102,7 @@ func TestRlpxFrameRW(t *testing.T) { for i := 0; i < 10; i++ { // write message into conn buffer wmsg := []interface{}{"foo", "bar", strings.Repeat("test", i)} - err := EncodeMsg(rw1, uint64(i), wmsg) + err := EncodeMsg(rw1, uint64(i), wmsg...) if err != nil { t.Fatalf("WriteMsg error (i=%d): %v", i, err) } |