hoytech / strfry

a nostr relay
GNU General Public License v3.0
489 stars 96 forks source link

filters: match >=, <= for since, until #110

Closed alexgleason closed 3 months ago

alexgleason commented 4 months ago

NIP-01:

The since and until properties can be used to specify the time range of events returned in the subscription. If a filter includes the since property, events with created_at greater than or equal to since are considered to match the filter. The until property is similar except that created_at must be less than or equal to until. In short, an event matches a filter if since <= created_at <= until holds.

I am not sure if this also needs to be changed somewhere else when indexing.

alexgleason commented 3 months ago

@hoytech Can you check this please?

hoytech commented 3 months ago

I remember when we standardised this. I was happy because strfry already did it this way and I didn't have to change anything :)

Here's the link to the github issue: https://github.com/nostr-protocol/nips/issues/650

About this PR, it seems to make doesMatchTimes return false when created is equal to since or until. My reading of the spec is that these values are inclusive, so it should match when equal, and the code is right without the change. I could be missing some context though?

alexgleason commented 3 months ago

My mistake, thank you for clarifying!