diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-19 23:07:59 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-19 23:07:59 +0800 |
commit | 8eff550e8b9bf121c27a4c2469ec9878d803a60e (patch) | |
tree | ddc62daeec7a44c2baacb986f8c9d76df25a5976 /eth | |
parent | 4683f9c0a71fd42e749da46ac56c6ba76f379931 (diff) | |
parent | 8f3a7e41deff4084b166aca1337258077bd2a3e6 (diff) | |
download | dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.gz dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.bz2 dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.lz dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.xz dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.zst dexon-8eff550e8b9bf121c27a4c2469ec9878d803a60e.zip |
Merge branch 'fjl-rlp-size-validation' into develop
Diffstat (limited to 'eth')
-rw-r--r-- | eth/handler.go | 12 |
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 |