fix: deliver events to every matching subscription on a connection #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/notify-all-subscriptions"
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
NostrClientConnection.notify_eventreturned after the first filter that matched, so a connection holding several subscriptions only ever received a live event on one of them.That is invisible when each client has its own connection, but nostrclient multiplexes every one of its clients through a single upstream connection. On four84, nwcprovider (via nostrclient over loopback) subscribes to its own kind-23195 responses; that filter is registered before any wallet app's. Every NWC reply was therefore handed to the provider's subscription and delivery stopped, so the wallet app's subscription on the same connection never saw it. Amethyst reported "Wallet request timed out" even though the journal showed both the 23194 request and the 23195 reply on the relay.
Pairing the same app directly against
wss://…/nostrrelay/<id>worked, because the app then had its own connection and filter list.Reproduced with a two-client simulation (
nwcsim3.py, provider also subscribed to its own responses): direct relay delivers, via nostrclient it times out. Upstreamlnbits/nostrrelay(a87bc1f) has the identical first-matchreturn True, so this is recorded in the newdocs/upstream-candidates.md.Change
relay/client_connection.py— iterate all filters, send once per subscription id, return whether anything was delivered.tests/test_notify.py— three tests: multi-subscription delivery, dedupe when one subscription has several matching filters, nothing sent when nothing matches.docs/upstream-candidates.md— started.1.1.0-aio.3(separate commit).Verification
pytestontests/test_notify.py+tests/test_nip17.py: 12 passed.NostrFilter(**kwargs)typing), none introduced.Release steps after merge
git tag v1.1.0-aio.3 && git push origin v1.1.0-aio.3aiolabs/lnbits-extensions/extensions.json(keep the1.1.0-aio.2entry).🤖 Generated with Claude Code
https://claude.ai/code/session_013Tbyw6FwjhEJg3gHfPHxWt