fix(nip17): drop since filter on kind 1059 subscription #4

Merged
padreug merged 1 commit from fix/gift-wrap-since-filter into main 2026-05-03 15:42:57 +00:00

View file

@ -152,10 +152,13 @@ class NostrClient:
def _filters_for_direct_messages(self, public_keys: List[str], since: int) -> List: def _filters_for_direct_messages(self, public_keys: List[str], since: int) -> List:
# NIP-17/NIP-59: subscribe to kind 1059 gift wraps addressed to our merchants. # NIP-17/NIP-59: subscribe to kind 1059 gift wraps addressed to our merchants.
# With gift wrapping, outgoing messages are self-wrapped (same p-tag filter). # With gift wrapping, outgoing messages are self-wrapped (same p-tag filter).
#
# Do NOT apply `since` here. Per NIP-59, gift wraps use randomized past
# timestamps (up to 2 days back) to defeat metadata correlation, so a
# `since` derived from the latest DM in our DB will reject fresh wraps
# whose randomized created_at is older than that window. Server-side
# dedup + the client's is_duplicate_event() guard handle replays.
gift_wrap_filter: dict = {"kinds": [1059], "#p": public_keys} gift_wrap_filter: dict = {"kinds": [1059], "#p": public_keys}
if since and since != 0:
gift_wrap_filter["since"] = since
return [gift_wrap_filter] return [gift_wrap_filter]
def _filters_for_stall_events(self, public_keys: List[str], since: int) -> List: def _filters_for_stall_events(self, public_keys: List[str], since: int) -> List: