mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
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
This commit is contained in:
parent
2ea72daf4f
commit
018cfd0b6d
@ -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()
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user