Generic single-letter tag filters (NIP-12 / NIP-01 §filters) #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
NostrFilterstruct hardcodes only three tag fields:Any other single-letter tag query (
#a,#t,#r,#k,#l, …) issilently dropped. NIP-01 §filters mandates support for arbitrary
single-letter tag filters; this is the historical NIP-12 behaviour now
folded into NIP-01.
Impact
#afilters cannot select addressable events by theirkind:pubkey:dcoordinate — affects clients that follow NIP-33 addressable replaceable
flows
#t(hashtag),#r(reference),#k(kind reference) and otherecosystem conventions don't work on this relay
Suggested approach
Replace the three fixed fields with a
dict[str, list[str]]keyed by thesingle-letter tag name (matching
^#[a-zA-Z]$). Update bothNostrFilter.matches()andNostrFilter.to_sql_components()accordingly.Reference designs:
.catchall(z.array(z.string().max(1024)))+isGenericTagQueryregexflat_hash_map<char, FilterSetBytes>nostr.TagMapOut of scope
This was deferred from #PR-feat-nip17-gift-wrap-support because NIP-17
only needs
#p, which already works.