feat: subscribe to protocol v2 (kind 14) events in the Nostr listener - #32
Conversation
Mostro daemons advertising protocol_version=2 reply to clients with signed kind-14 NIP-44 direct messages addressed to the trade pubkey in the p tag, instead of kind-1059 gift wraps. The listener only watched kind 1059, so against a v2 node it never matched any event: no FCM/ UnifiedPush wake was ever dispatched and mobile users stopped getting notifications while the app was killed or dozing (reported after the mobile v1.3.0 transport v2 rollout). Subscribe to kinds 1059 and 14 and dispatch on either, still matching by p tag only. No author filter is added (hard constraint #1 stands): pushes fire solely for registered trade pubkeys, so the p-tag match is sufficient for kind 14 as well. Also extract the p-tag lookup into extract_recipient() and add unit tests for the watched-kind set and recipient extraction.
|
Warning Review limit reached
Next review available in: 47 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
Mobile users on v1.3.0 report missing notifications when their orders are taken (companion mobile PRs: MostroP2P/mobile#640, MostroP2P/mobile#641).
The mobile v1.3.0 release completed the transport v2 migration: against a daemon advertising
protocol_version=2, node→client messages are signed kind-14 NIP-44 direct messages addressed to the trade pubkey in theptag — not kind-1059 gift wraps.The listener (
src/nostr/listener.rs) only subscribed tokind 1059. Against a v2 node it never matches any event, so no FCM/UnifiedPush wake is ever dispatched and users get no notifications while the app is killed or dozing. Notifications only appear when they reopen the app.Fix
ptag only.p-tag lookup intoextract_recipient()and add awatched_kinds()helper so the kind set has a single definition (filter + handler).config.rsdefaultevent_kinds(doc-parity field),config.toml.example, and the kind-1059 mentions in README / docs / CLAUDE.md.Test plan
src/nostr/listener.rs:extract_recipientreturns the firstptag /Nonewithout onecargo fmt— cleancargo clippy --all-targets— no warningscargo test— 46 tests passNotes for reviewers
kind_label()).