-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Code review
After reviewing this PR for bugs and CLAUDE.md compliance, I found one issue:
Potential infinite wait state in SendSheet.swift
Location: Bitkit/Views/Wallets/Send/SendSheet.swift lines 197-200
Issue: If Lightning channels exist but never become usable (e.g., peer permanently offline, stuck channel state), users will be trapped in the sync overlay indefinitely with no escape.
The early return at lines 197-200 exits without setting hasValidatedAfterSync = true. The onChange(of: wallet.hasUsableChannels) handler only fires when the value changes. If channels remain permanently unusable, the validation never completes and the user cannot dismiss the sync overlay or proceed.
Suggested fix: Add a timeout mechanism or fallback logic:
// Option 1: Add timeout state
@State private var syncStartTime: Date?
// In .onAppear or when showing overlay:
syncStartTime = Date()
// In validatePaymentAfterSync:
let syncDuration = Date().timeIntervalSince(syncStartTime ?? Date())
if hasAnyChannels, !wallet.hasUsableChannels {
if syncDuration > 30 { // 30 second timeout
// Fall back to onchain or show "channels unavailable" error
hasValidatedAfterSync = true
// Proceed with validation or dismiss
} else {
return
}
}Or add a manual dismiss option in the sync overlay UI so users aren't trapped if something goes wrong.
Originally posted by @claude[bot] in #401 (comment)