From 9e8cc00b733a505c2815b58d94315298371579cb Mon Sep 17 00:00:00 2001
From: Felix Lange <fjl@twurst.com>
Date: Tue, 19 Nov 2019 17:16:08 +0100
Subject: [PATCH] p2p: remove unused code (#20325)

---
 p2p/rlpx.go   | 10 ----------
 p2p/server.go |  3 +--
 p2p/util.go   | 11 -----------
 3 files changed, 1 insertion(+), 23 deletions(-)

diff --git a/p2p/rlpx.go b/p2p/rlpx.go
index 115021fa9..c9ca6ea42 100644
--- a/p2p/rlpx.go
+++ b/p2p/rlpx.go
@@ -422,16 +422,6 @@ func (h *encHandshake) makeAuthResp() (msg *authRespV4, err error) {
 	return msg, nil
 }
 
-func (msg *authMsgV4) sealPlain(h *encHandshake) ([]byte, error) {
-	buf := make([]byte, authMsgLen)
-	n := copy(buf, msg.Signature[:])
-	n += copy(buf[n:], crypto.Keccak256(exportPubkey(&h.randomPrivKey.PublicKey)))
-	n += copy(buf[n:], msg.InitiatorPubkey[:])
-	n += copy(buf[n:], msg.Nonce[:])
-	buf[n] = 0 // token-flag
-	return ecies.Encrypt(rand.Reader, h.remote, buf, nil, nil)
-}
-
 func (msg *authMsgV4) decodePlain(input []byte) {
 	n := copy(msg.Signature[:], input)
 	n += shaLen // skip sha3(initiator-ephemeral-pubk)
diff --git a/p2p/server.go b/p2p/server.go
index 1bda3acd9..9b9effaf6 100644
--- a/p2p/server.go
+++ b/p2p/server.go
@@ -199,7 +199,6 @@ type Server struct {
 	checkpointAddPeer       chan *conn
 
 	// State of run loop and listenLoop.
-	lastLookup     time.Time
 	inboundHistory expHeap
 }
 
@@ -410,7 +409,7 @@ type sharedUDPConn struct {
 func (s *sharedUDPConn) ReadFromUDP(b []byte) (n int, addr *net.UDPAddr, err error) {
 	packet, ok := <-s.unhandled
 	if !ok {
-		return 0, nil, errors.New("Connection was closed")
+		return 0, nil, errors.New("connection was closed")
 	}
 	l := len(packet.Data)
 	if l > len(b) {
diff --git a/p2p/util.go b/p2p/util.go
index 2a6edf5ce..018cc40e9 100644
--- a/p2p/util.go
+++ b/p2p/util.go
@@ -40,17 +40,6 @@ func (h *expHeap) add(item string, exp time.Time) {
 	heap.Push(h, expItem{item, exp})
 }
 
-// remove removes an item.
-func (h *expHeap) remove(item string) bool {
-	for i, v := range *h {
-		if v.item == item {
-			heap.Remove(h, i)
-			return true
-		}
-	}
-	return false
-}
-
 // contains checks whether an item is present.
 func (h expHeap) contains(item string) bool {
 	for _, v := range h {
-- 
GitLab