aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-01-06 20:13:16 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-01-06 20:13:16 +0800
commit3b8725e0f5622733dcb6c3ec142a83ddbb94bd6c (patch)
treecf9e8919920cfc3a3ea776bfd1d04442d05efdaf /eth
parent117f66e82375b752cc6a9ff22aa0d398ac337bb4 (diff)
parent3caa4ad1baba3019c06733e1a80d78d9a57137bb (diff)
downloadgo-tangerine-3b8725e0f5622733dcb6c3ec142a83ddbb94bd6c.tar
go-tangerine-3b8725e0f5622733dcb6c3ec142a83ddbb94bd6c.tar.gz
go-tangerine-3b8725e0f5622733dcb6c3ec142a83ddbb94bd6c.tar.bz2
go-tangerine-3b8725e0f5622733dcb6c3ec142a83ddbb94bd6c.tar.lz
go-tangerine-3b8725e0f5622733dcb6c3ec142a83ddbb94bd6c.tar.xz
go-tangerine-3b8725e0f5622733dcb6c3ec142a83ddbb94bd6c.tar.zst
go-tangerine-3b8725e0f5622733dcb6c3ec142a83ddbb94bd6c.zip
Merge pull request #239 from fjl/grab-bag
Grab bag of fixes
Diffstat (limited to 'eth')
-rw-r--r--eth/protocol.go8
-rw-r--r--eth/protocol_test.go4
2 files changed, 4 insertions, 8 deletions
diff --git a/eth/protocol.go b/eth/protocol.go
index b67e5aaea..723ab5502 100644
--- a/eth/protocol.go
+++ b/eth/protocol.go
@@ -140,7 +140,7 @@ func (self *ethProtocol) handle() error {
return self.protoError(ErrDecode, "->msg %v: %v", msg, err)
}
hashes := self.chainManager.GetBlockHashesFromHash(request.Hash, request.Amount)
- return self.rw.EncodeMsg(BlockHashesMsg, ethutil.ByteSliceToInterface(hashes)...)
+ return p2p.EncodeMsg(self.rw, BlockHashesMsg, ethutil.ByteSliceToInterface(hashes)...)
case BlockHashesMsg:
// TODO: redo using lazy decode , this way very inefficient on known chains
@@ -185,7 +185,7 @@ func (self *ethProtocol) handle() error {
break
}
}
- return self.rw.EncodeMsg(BlocksMsg, blocks...)
+ return p2p.EncodeMsg(self.rw, BlocksMsg, blocks...)
case BlocksMsg:
msgStream := rlp.NewStream(msg.Payload)
@@ -298,12 +298,12 @@ func (self *ethProtocol) handleStatus() error {
func (self *ethProtocol) requestBlockHashes(from []byte) error {
self.peer.Debugf("fetching hashes (%d) %x...\n", blockHashesBatchSize, from[0:4])
- return self.rw.EncodeMsg(GetBlockHashesMsg, interface{}(from), uint64(blockHashesBatchSize))
+ return p2p.EncodeMsg(self.rw, GetBlockHashesMsg, interface{}(from), uint64(blockHashesBatchSize))
}
func (self *ethProtocol) requestBlocks(hashes [][]byte) error {
self.peer.Debugf("fetching %v blocks", len(hashes))
- return self.rw.EncodeMsg(GetBlocksMsg, ethutil.ByteSliceToInterface(hashes)...)
+ return p2p.EncodeMsg(self.rw, GetBlocksMsg, ethutil.ByteSliceToInterface(hashes)...)
}
func (self *ethProtocol) protoError(code int, format string, params ...interface{}) (err *protocolError) {
diff --git a/eth/protocol_test.go b/eth/protocol_test.go
index ab2aa289f..224b59abd 100644
--- a/eth/protocol_test.go
+++ b/eth/protocol_test.go
@@ -41,10 +41,6 @@ func (self *testMsgReadWriter) WriteMsg(msg p2p.Msg) error {
return nil
}
-func (self *testMsgReadWriter) EncodeMsg(code uint64, data ...interface{}) error {
- return self.WriteMsg(p2p.NewMsg(code, data...))
-}
-
func (self *testMsgReadWriter) ReadMsg() (p2p.Msg, error) {
msg, ok := <-self.in
if !ok {