Skip to content

Commit

Permalink
fix(dot/sync): wrong error message at checkOrGetDescendantHash (#2971)
Browse files Browse the repository at this point in the history
  • Loading branch information
EclesioMeloJunior committed Nov 29, 2022
1 parent 19c9a7e commit b1c6bf1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dot/sync/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ func (s *Service) checkOrGetDescendantHash(ancestor common.Hash,
// if descendant number is lower than ancestor number, this is an error
if header.Number > descendantNumber {
return common.Hash{},
fmt.Errorf("invalid request, descendant number %d is higher than ancestor %d",
header.Number, descendantNumber)
fmt.Errorf("invalid request, descendant number %d is lower than ancestor %d",
descendantNumber, header.Number)
}

// check if provided start hash is descendant of provided descendant hash
Expand Down
2 changes: 1 addition & 1 deletion dot/sync/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func TestService_checkOrGetDescendantHash(t *testing.T) {
},
args: args{ancestor: common.Hash{2}, descendant: &common.Hash{1, 2}, descendantNumber: 1},
want: common.Hash{},
expectedError: errors.New("invalid request, descendant number 2 is higher than ancestor 1"),
expectedError: errors.New("invalid request, descendant number 1 is lower than ancestor 2"),
},
}
for _, tt := range tests {
Expand Down

0 comments on commit b1c6bf1

Please sign in to comment.