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/discover: fix typos in comments #25272

Merged
merged 1 commit into from
Jul 10, 2022
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
2 changes: 1 addition & 1 deletion p2p/discover/ntp.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func sntpDrift(measurements int) (time.Duration, error) {
// Calculate the drift based on an assumed answer time of RRT/2
drifts = append(drifts, sent.Sub(t)+elapsed/2)
}
// Calculate average drif (drop two extremities to avoid outliers)
// Calculate average drift (drop two extremities to avoid outliers)
sort.Sort(durationSlice(drifts))

drift := time.Duration(0)
Expand Down
6 changes: 3 additions & 3 deletions p2p/discover/table_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ func newPingRecorder() *pingRecorder {
}
}

// setRecord updates a node record. Future calls to ping and
// requestENR will return this record.
// updateRecord updates a node record. Future calls to ping and
// RequestENR will return this record.
func (t *pingRecorder) updateRecord(n *enode.Node) {
t.mu.Lock()
defer t.mu.Unlock()
Expand All @@ -162,7 +162,7 @@ func (t *pingRecorder) ping(n *enode.Node) (seq uint64, err error) {
return seq, nil
}

// requestENR simulates an ENR request.
// RequestENR simulates an ENR request.
func (t *pingRecorder) RequestENR(n *enode.Node) (*enode.Node, error) {
t.mu.Lock()
defer t.mu.Unlock()
Expand Down
2 changes: 1 addition & 1 deletion p2p/discover/v4_udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func (t *UDPv4) findnode(toid enode.ID, toaddr *net.UDPAddr, target v4wire.Pubke
return nodes, err
}

// RequestENR sends enrRequest to the given node and waits for a response.
// RequestENR sends ENRRequest to the given node and waits for a response.
func (t *UDPv4) RequestENR(n *enode.Node) (*enode.Node, error) {
addr := &net.UDPAddr{IP: n.IP(), Port: n.UDP()}
t.ensureBond(n.ID(), addr)
Expand Down
2 changes: 1 addition & 1 deletion p2p/discover/v4_udp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ func TestUDPv4_EIP868(t *testing.T) {
t.Fatalf("invalid record: %v", err)
}
if !reflect.DeepEqual(n, wantNode) {
t.Fatalf("wrong node in enrResponse: %v", n)
t.Fatalf("wrong node in ENRResponse: %v", n)
}
})
}
Expand Down
6 changes: 3 additions & 3 deletions p2p/discover/v4wire/v4wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ type (
Rest []rlp.RawValue `rlp:"tail"`
}

// enrRequest queries for the remote node's record.
// ENRRequest queries for the remote node's record.
ENRRequest struct {
Expiration uint64
// Ignore additional fields (for forward compatibility).
Rest []rlp.RawValue `rlp:"tail"`
}

// enrResponse is the reply to enrRequest.
// ENRResponse is the reply to ENRRequest.
ENRResponse struct {
ReplyTok []byte // Hash of the enrRequest packet.
ReplyTok []byte // Hash of the ENRRequest packet.
Record enr.Record
// Ignore additional fields (for forward compatibility).
Rest []rlp.RawValue `rlp:"tail"`
Expand Down
2 changes: 1 addition & 1 deletion p2p/discover/v5_udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func (t *UDPv5) ping(n *enode.Node) (uint64, error) {
}
}

// requestENR requests n's record.
// RequestENR requests n's record.
func (t *UDPv5) RequestENR(n *enode.Node) (*enode.Node, error) {
nodes, err := t.findnode(n, []uint{0})
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions p2p/discover/v5wire/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func (c *Codec) encodeWhoareyou(toID enode.ID, packet *Whoareyou) (Header, error
return head, nil
}

// encodeHandshakeMessage encodes the handshake message packet header.
// encodeHandshakeHeader encodes the handshake message packet header.
func (c *Codec) encodeHandshakeHeader(toID enode.ID, addr string, challenge *Whoareyou) (Header, *session, error) {
// Ensure calling code sets challenge.node.
if challenge.Node == nil {
Expand Down Expand Up @@ -337,7 +337,7 @@ func (c *Codec) encodeHandshakeHeader(toID enode.ID, addr string, challenge *Who
return head, session, err
}

// encodeAuthHeader creates the auth header on a request packet following WHOAREYOU.
// makeHandshakeAuth creates the auth header on a request packet following WHOAREYOU.
func (c *Codec) makeHandshakeAuth(toID enode.ID, addr string, challenge *Whoareyou) (*handshakeAuthData, *session, error) {
auth := new(handshakeAuthData)
auth.h.SrcID = c.localnode.ID()
Expand Down Expand Up @@ -379,7 +379,7 @@ func (c *Codec) makeHandshakeAuth(toID enode.ID, addr string, challenge *Whoarey
return auth, sec, err
}

// encodeMessage encodes an encrypted message packet.
// encodeMessageHeader encodes an encrypted message packet.
func (c *Codec) encodeMessageHeader(toID enode.ID, s *session) (Header, error) {
head := c.makeHeader(toID, flagMessage, 0)

Expand Down Expand Up @@ -632,7 +632,7 @@ func (h *StaticHeader) checkValid(packetLen int) error {
return nil
}

// headerMask returns a cipher for 'masking' / 'unmasking' packet headers.
// mask returns a cipher for 'masking' / 'unmasking' packet headers.
func (h *Header) mask(destID enode.ID) cipher.Stream {
block, err := aes.NewCipher(destID[:16])
if err != nil {
Expand Down