Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
p2p: remove unused code (ethereum#20325)
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl authored and elizabethengelman committed Dec 20, 2019
1 parent 1a52d18 commit 2ecd59c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 23 deletions.
10 changes: 0 additions & 10 deletions p2p/rlpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ type Server struct {
checkpointAddPeer chan *conn

// State of run loop and listenLoop.
lastLookup time.Time
inboundHistory expHeap
}

Expand Down Expand Up @@ -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) {
Expand Down
11 changes: 0 additions & 11 deletions p2p/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2ecd59c

Please sign in to comment.