You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix(send): resolve indefinite sync overlay wait
When a lightning payment starts while channels exist but the peer is not
connected, the send sheet's "Connecting to network" overlay waited forever:
deferred validation early-returns and is only re-triggered by a
hasUsableChannels change that never fires if the peer never connects.
The overlay wait is now bounded to 20 seconds while the device is online.
On timeout, unified invoices take the existing lightning-to-onchain
fallback (the same decision AppViewModel makes at scan time when lightning
cannot pay), and everything else swaps the overlay copy to the existing
"Connection issues" strings while continuing to listen for the peer, with
swipe-down dismissal available throughout.
* chore: rename changelog fragment
* fix(send): restart sync timeout once the node is running
Review follow-up: the timeout task identity now includes node readiness,
so a window that started while the node was still starting restarts at
.running and the unified-invoice onchain fallback can still fire with
fresh balances (previously the Bool id never flipped again and no second
window was scheduled). The long-wait copy is also preserved while the
timer is merely paused by an offline blip, resetting only when the
overlay itself resolves.
* fix(send): show connection issues screen on sync timeout
Review feedback: instead of swapping the sync screen's copy, reuse the
existing OfflineSheetScreen for the timed-out state. OfflineSheetOverlayModifier
gains a forceShow flag so SendSheet can present it when the Lightning peer is
unreachable, not only when the device is offline.
Also clears stale scanned-invoice state when the send sheet opens fresh at
the options route, so closing the sheet during the sync overlay and tapping
Send again no longer reopens the overlay. The reset runs in onAppear for the
options route rather than onDisappear to avoid wiping a freshly scanned
invoice when SheetViewModel hides and re-shows the sheet for an incoming
deep link.
* fix(send): prefer lightning for unified invoices when peer offline
Review feedback: with the node running, unified invoices used to fall back
to onchain immediately when no channel was usable. They now prefer Lightning
and let the send sheet's sync overlay and timeout decide, so a briefly
offline peer no longer forces an onchain payment. No usable channels at all,
or usable channels without capacity, still fall back immediately.
* fix(send): guard routing-fee estimate against zero capacity
Found while testing the unified-invoice path with the peer disconnected:
calculateRoutingFee computed UInt64(maxSendLightningSats) - buffer, which
underflows and traps when maxSendLightningSats is 0 (no usable channel). A
zero-amount Lightning invoice routes to this screen, so the app crashed. With
no usable outbound capacity there is nothing to estimate, so the routing fee
is now 0 and the subtraction is guarded.
* refactor(send): tidy sync timeout additions
Cleanup pass over the PR's changes:
- Collapse the channels-but-unusable check in AppViewModel into a single
if-let, matching the idiom already used in the pure-bolt11 branch below.
- Use UInt64(clamping:) for the routing-fee capacity conversion instead of
a hand-rolled max(0, ...) inside a trapping initializer.
- Log shouldShowSyncOverlay on transitions via onChange instead of on every
evaluation; the new syncTimeoutPhase property raised the per-render
evaluation count, which tripled identical debug lines in the session log.
Sending no longer waits indefinitely or crashes when Lightning channels stay unavailable: Bitkit now prefers Lightning while the peer reconnects, then falls back to an onchain payment when possible or shows the connection issues screen after a short wait.
0 commit comments