aboutsummaryrefslogtreecommitdiffstats
path: root/eth/handler.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-01-07 01:30:44 +0800
committerGitHub <noreply@github.com>2017-01-07 01:30:44 +0800
commitac93a6ff6cd1200ab0fb67a5bd0c02cb70646632 (patch)
tree2b06aa1b360f1488264058d04e399e84b898f0d8 /eth/handler.go
parent444fc892b0a860218dab3e421d92c33408b9eb6d (diff)
parent13e3b2f433c48fe81423c1a13e9a5194ece61b01 (diff)
downloaddexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar
dexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.gz
dexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.bz2
dexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.lz
dexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.xz
dexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.zst
dexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.zip
Merge pull request #3525 from fjl/all-gosimple-cleanup
all: clean up lint issues, remove more dead code
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)