Skip to content

Commit bf6ae0e

Browse files
committed
Harden NWC request correlation and add Lightning Address payments
1 parent ea961ca commit bf6ae0e

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/main/nwc.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,19 @@ function openWs(relayUrl, walletPubkey, secretHex) {
6464
let pendingKey = requestId
6565

6666
// Legacy fallback for wallet services that do not return an e tag.
67-
// This keeps compatibility but still prefers proper NIP-47 correlation.
67+
// Only safe when exactly one request is pending.
6868
if (!pending) {
69+
if (pendingCalls.size !== 1) {
70+
console.warn('[NWC] Response without request correlation ignored', {
71+
requestId,
72+
pending: pendingCalls.size,
73+
})
74+
return
75+
}
76+
6977
const first = pendingCalls.entries().next()
7078
if (first.done) return
79+
7180
pendingKey = first.value[0]
7281
pending = first.value[1]
7382
}

0 commit comments

Comments
 (0)