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

fix(dot/sync): wrong error message at checkOrGetDescendantHash #2971

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
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