From 3372ed3f6d5e3a24a09b198d4df098a1139bedbb Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 2 Feb 2026 09:54:43 +0000 Subject: [PATCH] fix(zap): silently skip comment in LNURL callback if too long Instead of throwing an error when the comment exceeds the server's commentAllowed limit, simply don't include it in the LNURL callback. The comment is still preserved in the zap request event (kind 9734). https://claude.ai/code/session_01KTcAyKHVaqg4QKKXQxUzum --- src/components/ZapWindow.tsx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/components/ZapWindow.tsx b/src/components/ZapWindow.tsx index cd458b7..002a23b 100644 --- a/src/components/ZapWindow.tsx +++ b/src/components/ZapWindow.tsx @@ -354,17 +354,10 @@ export function ZapWindow({ // Check if LNURL server accepts comments (commentAllowed > 0) // The comment always goes in the zap request event (kind 9734 content) - // But only goes to the LNURL callback if the server accepts it + // But only goes to the LNURL callback if the server accepts it and it fits const commentAllowedLength = lnurlData.commentAllowed ?? 0; - - // Validate comment length for LNURL callback if server accepts comments - if (comment && commentAllowedLength > 0) { - if (comment.length > commentAllowedLength) { - throw new Error( - `Comment too long for payment. Maximum ${commentAllowedLength} characters.`, - ); - } - } + const canIncludeCommentInCallback = + commentAllowedLength > 0 && comment.length <= commentAllowedLength; // Step 3: Create and sign zap request event (kind 9734) // If zapping anonymously, create a throwaway signer @@ -390,12 +383,12 @@ export function ZapWindow({ const serializedZapRequest = serializeZapRequest(zapRequest); // Step 4: Fetch invoice from LNURL callback - // Only include comment in LNURL callback if server accepts it (commentAllowed > 0) + // Only include comment if server accepts it and it fits within the limit const invoiceResponse = await fetchInvoiceFromCallback( lnurlData.callback, amountMillisats, serializedZapRequest, - commentAllowedLength > 0 ? comment || undefined : undefined, + canIncludeCommentInCallback ? comment || undefined : undefined, ); const invoiceText = invoiceResponse.pr;