From 018cfd0b6d58e4d0fd920ee33ebbfdb61775426a Mon Sep 17 00:00:00 2001 From: rene <41963722+renaynay@users.noreply.github.com> Date: Wed, 29 Jul 2020 12:47:19 +0200 Subject: [PATCH] eth/downloader: remove eth62 (#21378) * init notes removed some mentions of eth62, bumped protocol err too old to >=63 * remove sanity checks and bump supported protocol version up to 63 * remove 62 tests, still need to add 65 * remove 65 tests # Conflicts: # eth/downloader/downloader_test.go # eth/downloader/peer.go --- eth/downloader/downloader.go | 4 ++-- eth/downloader/downloader_test.go | 3 +-- eth/downloader/peer.go | 16 +++------------- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index aaaf7f05f..a663e1131 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -95,7 +95,7 @@ var ( errCancelContentProcessing = errors.New("content processing canceled (requested)") errCanceled = errors.New("syncing canceled (requested)") errNoSyncActive = errors.New("no sync active") - errTooOld = errors.New("peer doesn't speak recent enough protocol version (need version >= 62)") + errTooOld = errors.New("peer doesn't speak recent enough protocol version (need version >= 63)") ) type Downloader struct { @@ -464,7 +464,7 @@ func (d *Downloader) syncWithPeer(p *peerConnection, hash common.Hash, blockNumb d.mux.Post(DoneEvent{latest}) } }() - if p.version < 62 { + if p.version < 63 { return errTooOld } mode := d.getMode() diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go index 2cae36a13..ffc6a504d 100644 --- a/eth/downloader/downloader_test.go +++ b/eth/downloader/downloader_test.go @@ -809,7 +809,6 @@ func testMultiProtoSync(t *testing.T, protocol int, mode SyncMode) { chain := testChainBase.shorten(blockCacheItems - 15) // Create peers of every type - require.NoError(tester.newPeer("peer 62", 62, chain)) require.NoError(tester.newPeer("peer 63", 63, chain)) require.NoError(tester.newPeer("peer 64", 64, chain)) require.NoError(tester.newPeer("peer 65", 65, chain)) @@ -821,7 +820,7 @@ func testMultiProtoSync(t *testing.T, protocol int, mode SyncMode) { assertOwnChain(t, tester, chain.len()) // Check that no peers have been dropped off - for _, version := range []int{62, 63, 64, 65} { + for _, version := range []int{63, 64} { peer := fmt.Sprintf("peer %d", version) if _, ok := tester.peers[peer]; !ok { t.Errorf("%s dropped", peer) diff --git a/eth/downloader/peer.go b/eth/downloader/peer.go index be1f1cb08..086d1b752 100644 --- a/eth/downloader/peer.go +++ b/eth/downloader/peer.go @@ -21,7 +21,6 @@ package downloader import ( "errors" - "fmt" "math" "sort" "sync" @@ -106,6 +105,9 @@ func (w *lightPeerWrapper) RequestBodies([]common.Hash) error { func (w *lightPeerWrapper) RequestReceipts([]common.Hash) error { panic("RequestReceipts not supported in light client mode sync") } +func (w *lightPeerWrapper) RequestNodeData([]common.Hash) error { + panic("RequestNodeData not supported in light client mode sync") +} // newPeerConnection creates a new downloader peer. func newPeerConnection(id string, version int, peer Peer, logger log.Logger) *peerConnection { @@ -138,10 +140,6 @@ func (p *peerConnection) Reset() { // FetchHeaders sends a header retrieval request to the remote peer. func (p *peerConnection) FetchHeaders(from uint64, count int) error { - // Sanity check the protocol version - if p.version < 62 { - panic(fmt.Sprintf("header fetch [eth/62+] requested on eth/%d", p.version)) - } // Short circuit if the peer is already fetching if !atomic.CompareAndSwapInt32(&p.headerIdle, 0, 1) { return errAlreadyFetching @@ -156,10 +154,6 @@ func (p *peerConnection) FetchHeaders(from uint64, count int) error { // FetchBodies sends a block body retrieval request to the remote peer. func (p *peerConnection) FetchBodies(request *fetchRequest) error { - // Sanity check the protocol version - if p.version < 62 { - panic(fmt.Sprintf("body fetch [eth/62+] requested on eth/%d", p.version)) - } // Short circuit if the peer is already fetching if !atomic.CompareAndSwapInt32(&p.blockIdle, 0, 1) { return errAlreadyFetching @@ -180,10 +174,6 @@ func (p *peerConnection) FetchBodies(request *fetchRequest) error { // FetchReceipts sends a receipt retrieval request to the remote peer. func (p *peerConnection) FetchReceipts(request *fetchRequest) error { - // Sanity check the protocol version - if p.version < 63 { - panic(fmt.Sprintf("body fetch [eth/63+] requested on eth/%d", p.version)) - } // Short circuit if the peer is already fetching if !atomic.CompareAndSwapInt32(&p.receiptIdle, 0, 1) { return errAlreadyFetching