aboutsummaryrefslogtreecommitdiffstats
path: root/eth/handler.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-01-06 23:44:20 +0800
committerFelix Lange <fjl@twurst.com>2017-01-07 01:18:07 +0800
commitf2da6581ba827a2aab091f764ace8017b26450d8 (patch)
tree3bf7ed2ec48812064c5eb6191c9848ad7985561b /eth/handler.go
parent35a7dcb162546f7f31cb6492f716cb93159218d7 (diff)
downloadgo-tangerine-f2da6581ba827a2aab091f764ace8017b26450d8.tar
go-tangerine-f2da6581ba827a2aab091f764ace8017b26450d8.tar.gz
go-tangerine-f2da6581ba827a2aab091f764ace8017b26450d8.tar.bz2
go-tangerine-f2da6581ba827a2aab091f764ace8017b26450d8.tar.lz
go-tangerine-f2da6581ba827a2aab091f764ace8017b26450d8.tar.xz
go-tangerine-f2da6581ba827a2aab091f764ace8017b26450d8.tar.zst
go-tangerine-f2da6581ba827a2aab091f764ace8017b26450d8.zip
all: fix issues reported by honnef.co/go/simple/cmd/gosimple
Diffstat (limited to 'eth/handler.go')
-rw-r--r--eth/handler.go30
1 files changed, 4 insertions, 26 deletions
diff --git a/eth/handler.go b/eth/handler.go
index 771e69b8d..1de3f67e6 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -607,38 +607,16 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
}
case msg.Code == NewBlockHashesMsg:
- // Retrieve and deserialize the remote new block hashes notification
- type announce struct {
- Hash common.Hash
- Number uint64
- }
- var announces = []announce{}
-
- if p.version < eth62 {
- // We're running the old protocol, make block number unknown (0)
- var hashes []common.Hash
- if err := msg.Decode(&hashes); err != nil {
- return errResp(ErrDecode, "%v: %v", msg, err)
- }
- for _, hash := range hashes {
- announces = append(announces, announce{hash, 0})
- }
- } else {
- // Otherwise extract both block hash and number
- var request newBlockHashesData
- if err := msg.Decode(&request); err != nil {
- return errResp(ErrDecode, "%v: %v", msg, err)
- }
- for _, block := range request {
- announces = append(announces, announce{block.Hash, block.Number})
- }
+ var announces newBlockHashesData
+ if err := msg.Decode(&announces); err != nil {
+ return errResp(ErrDecode, "%v: %v", msg, err)
}
// Mark the hashes as present at the remote node
for _, block := range announces {
p.MarkBlock(block.Hash)
}
// Schedule all the unknown hashes for retrieval
- unknown := make([]announce, 0, len(announces))
+ unknown := make(newBlockHashesData, 0, len(announces))
for _, block := range announces {
if !pm.blockchain.HasBlock(block.Hash) {
unknown = append(unknown, block)