Bug
When scanning a unified QR code (BIP21 with lightning= parameter) that has no amount, the amount screen opens but only shows Savings — the Spending (Lightning) option is never available.
Reported in: #840 (issuecomment-4067321393)
Steps to reproduce
- Disable QuickPay
- Scan a unified no-amount invoice (BIP21 with lightning parameter, no amount set) using the camera
- Amount screen opens
- Only "Savings" is shown — no option to switch to "Spending"
Root cause
extractViableLightningInvoice() (AppViewModel.kt:951) calls lightningRepo.canSend(1u) to check if the Lightning invoice is viable.
canSend() (LightningRepo.kt:1180) returns false when the node is Running but channels aren't ready (null after timeout) or have zero outbound HTLC capacity. There is an optimistic check for the Stopped state, but it doesn't cover the Running-with-channels-not-ready case.
When canSend returns false:
extractViableLightningInvoice returns null
isUnified is set to false (line 1250)
PaymentMethodButton is disabled (only current method shown)
- User sees only "Savings" with no way to switch
Suggested fix
For no-amount unified invoices, the canSend check is overly restrictive — the user hasn't entered an amount yet, so checking capacity for 1 sat is a proxy that can fail. Options:
- Use cached balance fallback (
cacheStore.data.first().balance?.maxSendLightningSats) when the node is running but channels aren't ready
- Skip the
canSend check entirely for no-amount invoices and let the amount screen validate after the user enters an amount
- Extend the optimistic check to cover the
Starting/Running states when channels are temporarily unavailable
Pre-existing
This bug exists on master — the same extractViableLightningInvoice → canSend → isUnified logic is unchanged.
Bug
When scanning a unified QR code (BIP21 with
lightning=parameter) that has no amount, the amount screen opens but only shows Savings — the Spending (Lightning) option is never available.Reported in: #840 (issuecomment-4067321393)
Steps to reproduce
Root cause
extractViableLightningInvoice()(AppViewModel.kt:951) callslightningRepo.canSend(1u)to check if the Lightning invoice is viable.canSend()(LightningRepo.kt:1180) returnsfalsewhen the node isRunningbut channels aren't ready (null after timeout) or have zero outbound HTLC capacity. There is an optimistic check for theStoppedstate, but it doesn't cover theRunning-with-channels-not-ready case.When
canSendreturnsfalse:extractViableLightningInvoicereturnsnullisUnifiedis set tofalse(line 1250)PaymentMethodButtonis disabled (only current method shown)Suggested fix
For no-amount unified invoices, the
canSendcheck is overly restrictive — the user hasn't entered an amount yet, so checking capacity for1 satis a proxy that can fail. Options:cacheStore.data.first().balance?.maxSendLightningSats) when the node is running but channels aren't readycanSendcheck entirely for no-amount invoices and let the amount screen validate after the user enters an amountStarting/Runningstates when channels are temporarily unavailablePre-existing
This bug exists on
master— the sameextractViableLightningInvoice→canSend→isUnifiedlogic is unchanged.