diff --git a/les/peer.go b/les/peer.go index a29a135111..c3b83a5f90 100644 --- a/les/peer.go +++ b/les/peer.go @@ -144,6 +144,13 @@ func (p *peer) rejectUpdate(size uint64) bool { // region. The client is also notified about being frozen/unfrozen with a Stop/Resume // message. func (p *peer) freezeClient() { + if p.version < lpv3 { + // if Stop/Resume is not supported then just drop the peer after setting + // its frozen status permanently + atomic.StoreUint32(&p.frozen, 1) + p.Peer.Disconnect(p2p.DiscUselessPeer) + return + } if atomic.SwapUint32(&p.frozen, 1) == 0 { go func() { p.SendStop() diff --git a/les/protocol.go b/les/protocol.go index 2cbc6ccf74..ebf5814732 100644 --- a/les/protocol.go +++ b/les/protocol.go @@ -32,17 +32,18 @@ import ( // Constants to match up protocol versions and messages const ( lpv2 = 2 + lpv3 = 3 ) // Supported versions of the les protocol (first is primary) var ( - ClientProtocolVersions = []uint{lpv2} - ServerProtocolVersions = []uint{lpv2} + ClientProtocolVersions = []uint{lpv2, lpv3} + ServerProtocolVersions = []uint{lpv2, lpv3} AdvertiseProtocolVersions = []uint{lpv2} // clients are searching for the first advertised protocol in the list ) // Number of implemented message corresponding to different protocol versions. -var ProtocolLengths = map[uint]uint64{lpv2: 24} +var ProtocolLengths = map[uint]uint64{lpv2: 22, lpv3: 24} const ( NetworkId = 1 @@ -70,8 +71,9 @@ const ( SendTxV2Msg = 0x13 GetTxStatusMsg = 0x14 TxStatusMsg = 0x15 - StopMsg = 0x16 - ResumeMsg = 0x17 + // Protocol messages introduced in LPV3 + StopMsg = 0x16 + ResumeMsg = 0x17 ) type requestInfo struct {