Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p2p: remove unused code #20325

Merged
merged 1 commit into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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