aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-19 23:06:56 +0800
committerobscuren <geffobscura@gmail.com>2015-04-19 23:07:40 +0800
commit8f3a7e41deff4084b166aca1337258077bd2a3e6 (patch)
treeddc62daeec7a44c2baacb986f8c9d76df25a5976 /eth
parent4683f9c0a71fd42e749da46ac56c6ba76f379931 (diff)
parent7180699d401e64b52447ccb2cfb33004b7deb672 (diff)
downloadgo-tangerine-8f3a7e41deff4084b166aca1337258077bd2a3e6.tar
go-tangerine-8f3a7e41deff4084b166aca1337258077bd2a3e6.tar.gz
go-tangerine-8f3a7e41deff4084b166aca1337258077bd2a3e6.tar.bz2
go-tangerine-8f3a7e41deff4084b166aca1337258077bd2a3e6.tar.lz
go-tangerine-8f3a7e41deff4084b166aca1337258077bd2a3e6.tar.xz
go-tangerine-8f3a7e41deff4084b166aca1337258077bd2a3e6.tar.zst
go-tangerine-8f3a7e41deff4084b166aca1337258077bd2a3e6.zip
Merge branch 'rlp-size-validation' of https://github.com/fjl/go-ethereum into fjl-rlp-size-validation
Conflicts: eth/protocol.go
Diffstat (limited to 'eth')
-rw-r--r--eth/handler.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/eth/handler.go b/eth/handler.go
index 780ec3931..5c0660d84 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -197,7 +197,7 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
// returns either requested hashes or nothing (i.e. not found)
return p.sendBlockHashes(hashes)
case BlockHashesMsg:
- msgStream := rlp.NewStream(msg.Payload)
+ msgStream := rlp.NewStream(msg.Payload, uint64(msg.Size))
var hashes []common.Hash
if err := msgStream.Decode(&hashes); err != nil {
@@ -209,12 +209,12 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
}
case GetBlocksMsg:
- msgStream := rlp.NewStream(msg.Payload)
+ var blocks []*types.Block
+
+ msgStream := rlp.NewStream(msg.Payload, uint64(msg.Size))
if _, err := msgStream.List(); err != nil {
return err
}
-
- var blocks []*types.Block
var i int
for {
i++
@@ -236,9 +236,9 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
}
return p.sendBlocks(blocks)
case BlocksMsg:
- msgStream := rlp.NewStream(msg.Payload)
-
var blocks []*types.Block
+
+ msgStream := rlp.NewStream(msg.Payload, uint64(msg.Size))
if err := msgStream.Decode(&blocks); err != nil {
glog.V(logger.Detail).Infoln("Decode error", err)
blocks = nil