From 8b7faac4801e8e5f27c5cf43ab78074be0e1e356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ecl=C3=A9sio=20Junior?= Date: Wed, 23 Nov 2022 12:16:32 -0400 Subject: [PATCH 1/2] fix: wrong error message at `checkOrGetDescendantHash` --- dot/sync/message.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dot/sync/message.go b/dot/sync/message.go index 7baececb5e..b896ace9ce 100644 --- a/dot/sync/message.go +++ b/dot/sync/message.go @@ -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 From 5d98696af98064369977f93d6898538ab674fef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ecl=C3=A9sio=20Junior?= Date: Wed, 23 Nov 2022 12:54:19 -0400 Subject: [PATCH 2/2] chore: fix test message --- dot/sync/message_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dot/sync/message_test.go b/dot/sync/message_test.go index 5853aa5e8a..8abfd1923f 100644 --- a/dot/sync/message_test.go +++ b/dot/sync/message_test.go @@ -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 {