p2p: remove Equal function

This commit is contained in:
Kurkó Mihály 2018-10-17 18:48:03 +03:00
parent 100c6c9f47
commit 90993c2f78
2 changed files with 1 additions and 11 deletions

View file

@ -253,13 +253,3 @@ func RandomID(a ID, n int) (b ID) {
} }
return b return b
} }
// Equal returns a boolean reporting whether a and b contain the same bytes.
func Equal(a, b ID) bool {
for i := range a {
if a[i] != b[i] {
return false
}
}
return true
}

View file

@ -189,7 +189,7 @@ func (c *meteredConn) handshakeDone(id enode.ID) {
func (c *meteredConn) Close() error { func (c *meteredConn) Close() error {
err := c.Conn.Close() err := c.Conn.Close()
c.lock.RLock() c.lock.RLock()
if enode.Equal(c.id, enode.ID{}) { if c.id == (enode.ID{}) {
// If the peer disconnects before the handshake. // If the peer disconnects before the handshake.
c.lock.RUnlock() c.lock.RUnlock()
meteredPeerFeed.Send(MeteredPeerEvent{ meteredPeerFeed.Send(MeteredPeerEvent{