@@ -30,6 +30,8 @@ const (
30
30
// handshakeTimeout is the maximum allowed time for the `eth` handshake to
31
31
// complete before dropping the connection.= as malicious.
32
32
handshakeTimeout = 5 * time .Second
33
+
34
+ legacyNetworkID = 88
33
35
)
34
36
35
37
// Handshake executes the eth protocol handshake, negotiating version number,
@@ -41,14 +43,26 @@ func (p *Peer) Handshake(network uint64, td *big.Int, head common.Hash, genesis
41
43
var status StatusPacket // safe to read after two values have been received from errc
42
44
43
45
go func () {
44
- errc <- p2p .Send (p .rw , StatusMsg , & StatusPacket {
45
- ProtocolVersion : uint32 (p .version ),
46
- NetworkID : network ,
47
- TD : td ,
48
- Head : head ,
49
- Genesis : genesis ,
50
- ForkID : forkID ,
51
- })
46
+ switch {
47
+ case p .version == ETH65 :
48
+ errc <- p2p .Send (p .rw , StatusMsg , & StatusPacket {
49
+ ProtocolVersion : uint32 (p .version ),
50
+ NetworkID : legacyNetworkID ,
51
+ TD : td ,
52
+ Head : head ,
53
+ Genesis : genesis ,
54
+ ForkID : forkID ,
55
+ })
56
+ default :
57
+ errc <- p2p .Send (p .rw , StatusMsg , & StatusPacket {
58
+ ProtocolVersion : uint32 (p .version ),
59
+ NetworkID : network ,
60
+ TD : td ,
61
+ Head : head ,
62
+ Genesis : genesis ,
63
+ ForkID : forkID ,
64
+ })
65
+ }
52
66
}()
53
67
go func () {
54
68
errc <- p .readStatus (network , & status , genesis , forkFilter )
@@ -91,7 +105,7 @@ func (p *Peer) readStatus(network uint64, status *StatusPacket, genesis common.H
91
105
if err := msg .Decode (& status ); err != nil {
92
106
return fmt .Errorf ("%w: message %v: %v" , errDecode , msg , err )
93
107
}
94
- if status .NetworkID != network {
108
+ if status .NetworkID != network && status . NetworkID != legacyNetworkID {
95
109
return fmt .Errorf ("%w: %d (!= %d)" , errNetworkIDMismatch , status .NetworkID , network )
96
110
}
97
111
if uint (status .ProtocolVersion ) != p .version {
0 commit comments