Skip to content

Commit 5e0eb62

Browse files
authored
eth/protocols/eth: stop advertising eth/66 for pathdb nodes (#28006)
1 parent 6dc9cdf commit 5e0eb62

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

eth/protocols/eth/handler.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323

2424
"github.com/ethereum/go-ethereum/common"
2525
"github.com/ethereum/go-ethereum/core"
26+
"github.com/ethereum/go-ethereum/core/rawdb"
2627
"github.com/ethereum/go-ethereum/core/types"
2728
"github.com/ethereum/go-ethereum/metrics"
2829
"github.com/ethereum/go-ethereum/p2p"
@@ -95,11 +96,15 @@ type TxPool interface {
9596

9697
// MakeProtocols constructs the P2P protocol definitions for `eth`.
9798
func MakeProtocols(backend Backend, network uint64, dnsdisc enode.Iterator) []p2p.Protocol {
98-
protocols := make([]p2p.Protocol, len(ProtocolVersions))
99-
for i, version := range ProtocolVersions {
99+
protocols := make([]p2p.Protocol, 0, len(ProtocolVersions))
100+
for _, version := range ProtocolVersions {
100101
version := version // Closure
101102

102-
protocols[i] = p2p.Protocol{
103+
// Path scheme does not support GetNodeData, don't advertise eth66 on it
104+
if version <= ETH66 && backend.Chain().TrieDB().Scheme() == rawdb.PathScheme {
105+
continue
106+
}
107+
protocols = append(protocols, p2p.Protocol{
103108
Name: ProtocolName,
104109
Version: version,
105110
Length: protocolLengths[version],
@@ -119,7 +124,7 @@ func MakeProtocols(backend Backend, network uint64, dnsdisc enode.Iterator) []p2
119124
},
120125
Attributes: []enr.Entry{currentENREntry(backend.Chain())},
121126
DialCandidates: dnsdisc,
122-
}
127+
})
123128
}
124129
return protocols
125130
}

0 commit comments

Comments
 (0)