Skip to content

Commit

Permalink
use LimitZero instead of the -1 hack.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Apr 5, 2024
1 parent 800c344 commit d80b091
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func validateAndFilterReports(ctx context.Context, event *nostr.Event) (reject b
func removeAuthorsNotWhitelisted(ctx context.Context, filter *nostr.Filter) {
if n := len(filter.Authors); n > len(whitelist)*11/10 {
// this query was clearly badly constructed, so we will not bother even looking
filter.Limit = -1 // this causes the query to be short cut
filter.LimitZero = true // this causes the query to be short cut
} else if n > 0 {
// otherwise we go through the authors list and remove the irrelevant ones
newAuthors := make([]string, 0, n)
Expand All @@ -92,7 +92,7 @@ func removeAuthorsNotWhitelisted(ctx context.Context, filter *nostr.Filter) {
filter.Authors = newAuthors

if len(newAuthors) == 0 {
filter.Limit = -1 // this causes the query to be short cut
filter.LimitZero = true // this causes the query to be short cut
}
}
}

0 comments on commit d80b091

Please sign in to comment.