fix: stabilize send scan routing#925
fix: stabilize send scan routing#925ovitrif wants to merge 12 commits intofeat/connection-issues-viewfrom
Conversation
ac51d38 to
8c3e3d1
Compare
8c3e3d1 to
3851847
Compare
…-view # Conflicts: # app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt
This comment has been minimized.
This comment has been minimized.
|
Addressed the changelog fragment review note in |
This comment has been minimized.
This comment has been minimized.
| if (state.channels.isNotEmpty() || state.nodeLifecycleState.isRunning()) return state | ||
|
|
||
| Logger.info("Waiting for node to load channels before sending payment", context = TAG) | ||
| return withTimeoutOrNull(CHANNELS_USABLE_TIMEOUT_MS) { |
There was a problem hiding this comment.
CLAUDE.md violation: prefer Duration for timeouts and delays
CHANNELS_USABLE_TIMEOUT_MS is a raw Long constant (15_000L), but the CLAUDE.md rule states: "ALWAYS prefer Kotlin Duration for timeouts and delays".
This PR already introduces NO_USABLE_CHANNELS_FEEDBACK_DELAY = 2_500.milliseconds using Duration correctly, but reuses the old raw Long constant in both new call sites (here and line 1052).
The fix is to convert the constant to Duration:
// In companion object — change from:
private const val CHANNELS_USABLE_TIMEOUT_MS = 15_000L
// to:
private val CHANNELS_USABLE_TIMEOUT = 15.secondsThen update both call sites: withTimeoutOrNull(CHANNELS_USABLE_TIMEOUT_MS) → withTimeoutOrNull(CHANNELS_USABLE_TIMEOUT). Note: MS_SYNC_LOOP_DEBOUNCE and SYNC_RETRY_DELAY_MS are pre-existing and not touched by this PR.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Description
Fixes issues surfaced in #878:
Also fixes all lint issues accumulated in latest PRs (should later update build config to fail on lint errors).
Preview
before.mp4
after.mp4
QA Notes
Manual Tests
regression:Scanner → scan fixed amount LN invoice: Send Confirm or QuickPay opens directly.regression:Send → scanner/paste fixed amount LN invoice: in-sheet nav to Confirm or QuickPay.regression:Variable amount LN invoice/LNURL-pay: lands on Amount view.Automated Tests
Added new unit tests:
main scanner lightning scan opens send sheetmain scanner zero amount lightning scan opens amount sheetmain scanner lightning scan opens QuickPay when enabledwaitForUsableChannels waits for running state before treating empty channels as absent