aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/message_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-01-06 18:35:09 +0800
committerFelix Lange <fjl@twurst.com>2015-01-06 19:23:38 +0800
commiteb0e7b1b8120852a1d56aa0ebd3a98e652965635 (patch)
tree9e87afc204d178d89ed24cc43afcc3da6b252a49 /p2p/message_test.go
parent36e1e5f15142b37801844a072eb46ea67fbc8868 (diff)
downloadgo-tangerine-eb0e7b1b8120852a1d56aa0ebd3a98e652965635.tar.gz
go-tangerine-eb0e7b1b8120852a1d56aa0ebd3a98e652965635.tar.zst
go-tangerine-eb0e7b1b8120852a1d56aa0ebd3a98e652965635.zip
eth, p2p: remove EncodeMsg from p2p.MsgWriter
...and make it a top-level function instead. The original idea behind having EncodeMsg in the interface was that implementations might be able to encode RLP data to their underlying writer directly instead of buffering the encoded data. The encoder will buffer anyway, so that doesn't matter anymore. Given the recent problems with EncodeMsg (copy-pasted implementation bug) I'd rather implement once, correctly.
Diffstat (limited to 'p2p/message_test.go')
-rw-r--r--p2p/message_test.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/p2p/message_test.go b/p2p/message_test.go
index 066d2516d..5cde9abf5 100644
--- a/p2p/message_test.go
+++ b/p2p/message_test.go
@@ -75,8 +75,8 @@ func TestDecodeRealMsg(t *testing.T) {
func ExampleMsgPipe() {
rw1, rw2 := MsgPipe()
go func() {
- rw1.EncodeMsg(8, []byte{0, 0})
- rw1.EncodeMsg(5, []byte{1, 1})
+ EncodeMsg(rw1, 8, []byte{0, 0})
+ EncodeMsg(rw1, 5, []byte{1, 1})
rw1.Close()
}()
@@ -100,7 +100,7 @@ loop:
rw1, rw2 := MsgPipe()
done := make(chan struct{})
go func() {
- if err := rw1.EncodeMsg(1); err == nil {
+ if err := EncodeMsg(rw1, 1); err == nil {
t.Error("EncodeMsg returned nil error")
} else if err != ErrPipeClosed {
t.Error("EncodeMsg returned wrong error: got %v, want %v", err, ErrPipeClosed)