Add NIP-01 OK and CLOSED responses for client messages#68
Open
BenGWeeks wants to merge 1 commit intolnbits:mainfrom
Open
Add NIP-01 OK and CLOSED responses for client messages#68BenGWeeks wants to merge 1 commit intolnbits:mainfrom
BenGWeeks wants to merge 1 commit intolnbits:mainfrom
Conversation
The relay proxy was not sending NIP-01 required responses:
- EVENT messages now receive OK responses:
- ["OK", event_id, true, ""] when event is forwarded to relays
- ["OK", event_id, false, "error: no relay connections"] when no
relays are connected
- REQ messages now receive CLOSED responses when no relays are
connected: ["CLOSED", subscription_id, "error: no relay connections"]
Without OK responses, NWC clients using nostr-tools SimplePool.publish()
timeout after 4.4s waiting for confirmation, making NWC connections
unreliable or broken.
Fixes lnbits#52
Related: lnbits#40
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BenGWeeks
added a commit
to BenGWeeks/lightning-piggy-mobile
that referenced
this pull request
Apr 5, 2026
- Add TROUBLESHOOTING entry for re-applying the NIP-20 OK fix after LNbits upgrade or container recreate - Add scripts/apply_nip20_fix.py for patching Nostrclient router.py - Fix patches the EVENT handler to send NIP-01 OK responses (PR lnbits/nostrclient#68, still unmerged upstream) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The relay proxy was not sending NIP-01 required responses after receiving
EVENTandREQmessages from clients.Changes
["OK", event_id, true, ""]when the event is forwarded to upstream relays["OK", event_id, false, "error: no relay connections"]when no relays are connected["CLOSED", subscription_id, "error: no relay connections"]Why this matters
NIP-01 states:
Without OK responses, NWC clients using
nostr-toolsSimplePool.publish()timeout after 4.4s waiting for confirmation, causingNip47PublishError: failed to publish: AggregateError: All promises were rejected. This makes NWC connections unreliable — payments may succeed on the backend but the client reports failure, risking double payments from user retries.Testing
Verified by connecting directly via WebSocket:
Before patch:
After patch:
Tested with the
@getalby/sdkNWC client — NWCget_balance,pay_invoice, andlist_transactionsall work reliably after this fix.Fixes #52
Related: #40
🤖 Generated with Claude Code