mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +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)")
|
errCancelContentProcessing = errors.New("content processing canceled (requested)")
|
||||||
errCanceled = errors.New("syncing canceled (requested)")
|
errCanceled = errors.New("syncing canceled (requested)")
|
||||||
errNoSyncActive = errors.New("no sync active")
|
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 {
|
type Downloader struct {
|
||||||
@ -464,7 +464,7 @@ func (d *Downloader) syncWithPeer(p *peerConnection, hash common.Hash, blockNumb
|
|||||||
d.mux.Post(DoneEvent{latest})
|
d.mux.Post(DoneEvent{latest})
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if p.version < 62 {
|
if p.version < 63 {
|
||||||
return errTooOld
|
return errTooOld
|
||||||
}
|
}
|
||||||
mode := d.getMode()
|
mode := d.getMode()
|
||||||
|
@ -809,7 +809,6 @@ func testMultiProtoSync(t *testing.T, protocol int, mode SyncMode) {
|
|||||||
chain := testChainBase.shorten(blockCacheItems - 15)
|
chain := testChainBase.shorten(blockCacheItems - 15)
|
||||||
|
|
||||||
// Create peers of every type
|
// 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 63", 63, chain))
|
||||||
require.NoError(tester.newPeer("peer 64", 64, chain))
|
require.NoError(tester.newPeer("peer 64", 64, chain))
|
||||||
require.NoError(tester.newPeer("peer 65", 65, 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())
|
assertOwnChain(t, tester, chain.len())
|
||||||
|
|
||||||
// Check that no peers have been dropped off
|
// 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)
|
peer := fmt.Sprintf("peer %d", version)
|
||||||
if _, ok := tester.peers[peer]; !ok {
|
if _, ok := tester.peers[peer]; !ok {
|
||||||
t.Errorf("%s dropped", peer)
|
t.Errorf("%s dropped", peer)
|
||||||
|
@ -21,7 +21,6 @@ package downloader
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"math"
|
"math"
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
@ -106,6 +105,9 @@ func (w *lightPeerWrapper) RequestBodies([]common.Hash) error {
|
|||||||
func (w *lightPeerWrapper) RequestReceipts([]common.Hash) error {
|
func (w *lightPeerWrapper) RequestReceipts([]common.Hash) error {
|
||||||
panic("RequestReceipts not supported in light client mode sync")
|
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.
|
// newPeerConnection creates a new downloader peer.
|
||||||
func newPeerConnection(id string, version int, peer Peer, logger log.Logger) *peerConnection {
|
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.
|
// FetchHeaders sends a header retrieval request to the remote peer.
|
||||||
func (p *peerConnection) FetchHeaders(from uint64, count int) error {
|
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
|
// Short circuit if the peer is already fetching
|
||||||
if !atomic.CompareAndSwapInt32(&p.headerIdle, 0, 1) {
|
if !atomic.CompareAndSwapInt32(&p.headerIdle, 0, 1) {
|
||||||
return errAlreadyFetching
|
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.
|
// FetchBodies sends a block body retrieval request to the remote peer.
|
||||||
func (p *peerConnection) FetchBodies(request *fetchRequest) error {
|
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
|
// Short circuit if the peer is already fetching
|
||||||
if !atomic.CompareAndSwapInt32(&p.blockIdle, 0, 1) {
|
if !atomic.CompareAndSwapInt32(&p.blockIdle, 0, 1) {
|
||||||
return errAlreadyFetching
|
return errAlreadyFetching
|
||||||
@ -180,10 +174,6 @@ func (p *peerConnection) FetchBodies(request *fetchRequest) error {
|
|||||||
|
|
||||||
// FetchReceipts sends a receipt retrieval request to the remote peer.
|
// FetchReceipts sends a receipt retrieval request to the remote peer.
|
||||||
func (p *peerConnection) FetchReceipts(request *fetchRequest) error {
|
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
|
// Short circuit if the peer is already fetching
|
||||||
if !atomic.CompareAndSwapInt32(&p.receiptIdle, 0, 1) {
|
if !atomic.CompareAndSwapInt32(&p.receiptIdle, 0, 1) {
|
||||||
return errAlreadyFetching
|
return errAlreadyFetching
|
||||||
|
Loading…
Reference in New Issue
Block a user