Skip to content

Commit

Permalink
few renamings
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed Aug 16, 2023
1 parent 9e29211 commit 755b8a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions p2p/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (s *session[H]) doRequest(
log.Debugw("requesting headers from peer failed", "peer", stat.peerID, "err", err)
}

h, err := s.processResponse(r)
h, err := s.processResponses(r)
if err != nil {
logFn := log.Errorw

Expand Down Expand Up @@ -217,18 +217,18 @@ func (s *session[H]) doRequest(
}

// processResponses converts HeaderResponse to Header.
func (s *session[H]) processResponse(responses []*p2p_pb.HeaderResponse) ([]H, error) {
func (s *session[H]) processResponses(responses []*p2p_pb.HeaderResponse) ([]H, error) {
hdrs, err := processResponses[H](responses)
if err != nil {
return nil, err
}

return hdrs, s.validate(hdrs)
return hdrs, s.verify(hdrs)
}

// validate checks that the received range of headers is adjacent and is valid against the provided
// verify checks that the received range of headers is adjacent and is valid against the provided
// header.
func (s *session[H]) validate(headers []H) error {
func (s *session[H]) verify(headers []H) error {
// if `s.from` is empty, then additional validation for the header`s range is not needed.
if s.from.IsZero() {
return nil
Expand Down
4 changes: 2 additions & 2 deletions p2p/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func Test_Validate(t *testing.T) {
)

headers := suite.GenDummyHeaders(5)
err := ses.validate(headers)
err := ses.verify(headers)
assert.NoError(t, err)
}

Expand All @@ -53,6 +53,6 @@ func Test_ValidateFails(t *testing.T) {
headers := suite.GenDummyHeaders(5)
// break adjacency
headers[2] = headers[4]
err := ses.validate(headers)
err := ses.verify(headers)
assert.Error(t, err)
}

0 comments on commit 755b8a9

Please sign in to comment.