Skip to content

Commit 6ec1561

Browse files
authored
eth: implement eth66 (#22241)
* eth/protocols/eth: split up the eth protocol handlers * eth/protocols/eth: define eth-66 protocol messages * eth/protocols/eth: poc implement getblockheaders on eth/66 * eth/protocols/eth: implement remaining eth-66 handlers * eth/protocols: define handler map for eth 66 * eth/downloader: use protocol constants from eth package * eth/protocols/eth: add ETH66 capability * eth/downloader: tests for eth66 * eth/downloader: fix error in tests * eth/protocols/eth: use eth66 for outgoing requests * eth/protocols/eth: remove unused error type * eth/protocols/eth: define protocol length * eth/protocols/eth: fix pooled tx over eth66 * protocols/eth/handlers: revert behavioural change which caused tests to fail * eth/downloader: fix failing test * eth/protocols/eth: add testcases + fix flaw with header requests * eth/protocols: change comments * eth/protocols/eth: review fixes + fixed flaw in RequestOneHeader * eth/protocols: documentation * eth/protocols/eth: review concerns about types
1 parent b1835b3 commit 6ec1561

8 files changed

Lines changed: 1120 additions & 395 deletions

File tree

‎eth/downloader/downloader_test.go‎

Lines changed: 138 additions & 47 deletions
Large diffs are not rendered by default.

‎eth/downloader/peer.go‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"time"
3030

3131
"github.com/ethereum/go-ethereum/common"
32+
"github.com/ethereum/go-ethereum/eth/protocols/eth"
3233
"github.com/ethereum/go-ethereum/event"
3334
"github.com/ethereum/go-ethereum/log"
3435
)
@@ -457,7 +458,7 @@ func (ps *peerSet) HeaderIdlePeers() ([]*peerConnection, int) {
457458
defer p.lock.RUnlock()
458459
return p.headerThroughput
459460
}
460-
return ps.idlePeers(64, 65, idle, throughput)
461+
return ps.idlePeers(eth.ETH64, eth.ETH66, idle, throughput)
461462
}
462463

463464
// BodyIdlePeers retrieves a flat list of all the currently body-idle peers within
@@ -471,7 +472,7 @@ func (ps *peerSet) BodyIdlePeers() ([]*peerConnection, int) {
471472
defer p.lock.RUnlock()
472473
return p.blockThroughput
473474
}
474-
return ps.idlePeers(64, 65, idle, throughput)
475+
return ps.idlePeers(eth.ETH64, eth.ETH66, idle, throughput)
475476
}
476477

477478
// ReceiptIdlePeers retrieves a flat list of all the currently receipt-idle peers
@@ -485,7 +486,7 @@ func (ps *peerSet) ReceiptIdlePeers() ([]*peerConnection, int) {
485486
defer p.lock.RUnlock()
486487
return p.receiptThroughput
487488
}
488-
return ps.idlePeers(64, 65, idle, throughput)
489+
return ps.idlePeers(eth.ETH64, eth.ETH66, idle, throughput)
489490
}
490491

491492
// NodeDataIdlePeers retrieves a flat list of all the currently node-data-idle
@@ -499,7 +500,7 @@ func (ps *peerSet) NodeDataIdlePeers() ([]*peerConnection, int) {
499500
defer p.lock.RUnlock()
500501
return p.stateThroughput
501502
}
502-
return ps.idlePeers(64, 65, idle, throughput)
503+
return ps.idlePeers(eth.ETH64, eth.ETH66, idle, throughput)
503504
}
504505

505506
// idlePeers retrieves a flat list of all currently idle peers satisfying the

0 commit comments

Comments
 (0)