applying feedback

This commit is contained in:
Gabriel mermelstein 2025-01-17 18:21:47 +01:00
parent be664cd6ec
commit 9dd3b09d78
No known key found for this signature in database
GPG Key ID: 82B8134785FEAE0D
3 changed files with 8 additions and 7 deletions

View File

@ -2,6 +2,7 @@ package common
import (
"encoding/hex"
"errors"
"fmt"
)
@ -10,11 +11,11 @@ type MessageHash string
func ToMessageHash(val string) (MessageHash, error) {
if len(val) == 0 {
return "", fmt.Errorf("empty string not allowed")
return "", errors.New("empty string not allowed")
}
if len(val) < 2 || val[:2] != "0x" {
return "", fmt.Errorf("string must start with 0x")
return "", errors.New("string must start with 0x")
}
// Remove "0x" prefix for hex decoding

View File

@ -8,15 +8,15 @@ type StoreQueryRequest struct {
TimeStart *int64 `json:"time_start,omitempty"`
TimeEnd *int64 `json:"time_end,omitempty"`
MessageHashes *[]MessageHash `json:"message_hashes,omitempty"`
PaginationCursor MessageHash `json:"pagination_cursor,omitempty"`
PaginationCursor *MessageHash `json:"pagination_cursor,omitempty"`
PaginationForward bool `json:"pagination_forward"`
PaginationLimit *uint64 `json:"pagination_limit,omitempty"`
}
type StoreMessageResponse struct {
WakuMessage tmpWakuMessageJson `json:"message"`
PubsubTopic string `json:"pubsubTopic"`
MessageHash MessageHash `json:"messageHash"`
WakuMessage *tmpWakuMessageJson `json:"message"`
PubsubTopic string `json:"pubsubTopic"`
MessageHash MessageHash `json:"messageHash"`
}
type StoreQueryResponse struct {

View File

@ -777,7 +777,7 @@ func TestStore(t *testing.T) {
PaginationLimit: proto.Uint64(uint64(paginationLimit)),
PaginationForward: true,
TimeStart: timeStart,
PaginationCursor: res1.PaginationCursor,
PaginationCursor: &res1.PaginationCursor,
}
ctx4, cancel4 := context.WithTimeout(context.Background(), requestTimeout)