Skip to content

Commit

Permalink
Merge branch 'master' into feat/relay-api-autoshard
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyaprem authored Oct 17, 2023
2 parents 83adec1 + ac9d826 commit 84cbd85
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions waku/v2/protocol/filter/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/waku-org/go-waku/waku/v2/protocol/subscription"
"github.com/waku-org/go-waku/waku/v2/timesource"
"go.uber.org/zap"
"golang.org/x/exp/slices"
)

// FilterPushID_v20beta1 is the current Waku Filter protocol identifier used to allow
Expand Down Expand Up @@ -227,6 +228,9 @@ func (wf *WakuFilterLightNode) Subscribe(ctx context.Context, contentFilter prot
if len(contentFilter.ContentTopics) == 0 {
return nil, errors.New("at least one content topic is required")
}
if slices.Contains[string](contentFilter.ContentTopicsList(), "") {
return nil, errors.New("one or more content topics specified is empty")
}

if len(contentFilter.ContentTopics) > MaxContentTopicsPerRequest {
return nil, fmt.Errorf("exceeds maximum content topics: %d", MaxContentTopicsPerRequest)
Expand Down Expand Up @@ -415,6 +419,10 @@ func (wf *WakuFilterLightNode) Unsubscribe(ctx context.Context, contentFilter pr
return nil, errors.New("at least one content topic is required")
}

if slices.Contains[string](contentFilter.ContentTopicsList(), "") {
return nil, errors.New("one or more content topics specified is empty")
}

if len(contentFilter.ContentTopics) > MaxContentTopicsPerRequest {
return nil, fmt.Errorf("exceeds maximum content topics: %d", MaxContentTopicsPerRequest)
}
Expand Down

0 comments on commit 84cbd85

Please sign in to comment.