fix(wallet): accept uppercase QR-scanned BOLT11 invoices on send #103
No reviewers
Labels
No labels
app:activities
app:chat
app:events
app:forum
app:libra
app:market
app:restaurant
app:tasks
app:wallet
app:webapp
bug
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
aiolabs/webapp!103
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/uppercase-bolt11-send"
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
Scanning a Lightning invoice QR shows it decoded correctly (amount + description), but sending fails with "Invalid payment destination format" — see the reported screenshot (a 78 848-sat invoice decoded fine yet was rejected).
Root cause
QR codes encode BOLT11 as uppercase bech32 (
LNBC…). The detection path (SendDialog.isBolt11) lowercases before matching, so it decodes fine. ButWalletService.sendPaymentgated the bolt11 branch on a case-sensitiverequest.destination.startsWith('ln'):So uppercase invoices fell through to the
elseand threw the error — despite the UI showing a valid decode.Fix
lnbc/lntb/lntbs/lnbcrt) and send the lowercase canonical form.'ln'prefix also incidentally matched bech32 LNURLs (lnurl1…) and would misroute them to the bolt11 endpoint (the bolt11 branch is checked first); matching the full HRP closes that latent gap too.Test notes
vue-tsc --noEmitclean for the changed file.aio-demoafter the dev deploy: scan/paste an uppercaseLNBC…invoice and confirm the send succeeds; re-verify a lowercase invoice and a Lightning address still work.🤖 Generated with Claude Code
The send path detected and decoded uppercase invoices correctly (SendDialog's isBolt11 lowercases first) but WalletService.sendPayment gated the bolt11 branch on a case-sensitive startsWith('ln'), so QR-scanned invoices (uppercase bech32, e.g. LNBC...) fell through to the else and threw "Invalid payment destination format" despite the UI showing a valid decode. Detect BOLT11 case-insensitively by its HRP (lnbc/lntb/lntbs/lnbcrt) and send the lowercase canonical form. The bare 'ln' prefix also incidentally matched bech32 LNURLs (lnurl1...) and misrouted them to the bolt11 endpoint; matching the full HRP closes that gap too. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>