feat: reply OK to client-published events #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/ok-reply"
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
nostrclient never answered a client's
EVENTwith the NIP-01["OK", <id>, <accepted>, <message>]command result. Clients built on nostr-tools and similar libraries wait for that reply before treating a publish as successful, so NWC wallet apps paired againstwss://<host>/nostrclient/api/v1/relayreported "publish failed" even though the request had been fanned out to the upstream relays and answered by nwcprovider.Upstream
lnbits/nostrclienthas the same gap (checked atae674ef, 2026-07-13).Change
nostr/message_pool.py— parse relayOKmessages into aCommandResultMessagequeue, alongside events / notices / EOSE.nostr/client/client.py— pump that queue through a newcallback_command_results_func.tasks.py— store results keyed by event id, but only for ids some connected client is still waiting on (keeps the shared map bounded).router.py— track eachEVENTa client publishes (PendingPublish) and reply exactly oneOK:trueas soon as any relay accepts (multiplexer semantics: the event is out there),falseonce every relay connected at publish time has rejected it, with the last rejection message,falseafter a 10 s timeout,falseimmediately when no relay is connected.idare ignored (nothing to acknowledge).tests/test_router_ok.py— 6 unit tests covering the cases above, run against stubbed websocket + relay manager.1.2.0-aio.2(separate commit).Verification
black,ruff,mypy: clean.pytest: 7 passed (6 new + existingtest_init).Release steps after merge
git tag v1.2.0-aio.2 && git push origin v1.2.0-aio.2aiolabs/lnbits-extensions/extensions.json(keep1.2.0-aio.1).🤖 Generated with Claude Code
https://claude.ai/code/session_013Tbyw6FwjhEJg3gHfPHxWt