Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/src/main/java/to/bitkit/repositories/LightningRepo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,11 @@ class LightningRepo @Inject constructor(
do {
syncPending.set(false)
_lightningState.update { it.copy(isSyncingWallet = true) }
lightningService.sync()
runCatching {
lightningService.sync()
}.onFailure {
return@executeWhenNodeRunning Result.failure(it)
}
refreshChannelCache()
syncState()
if (syncPending.get()) delay(MS_SYNC_LOOP_DEBOUNCE)
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/java/to/bitkit/viewmodels/WalletViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,15 @@ class WalletViewModel @Inject constructor(
walletRepo.syncNodeAndWallet()
.onFailure {
Logger.error("Failed to refresh state: ${it.message}", it)
if (it is CancellationException || it.isTxSyncTimeout()) return@onFailure
if (it is CancellationException) return@onFailure
if (it.isTxSyncTimeout()) {
ToastEventBus.send(
type = Toast.ToastType.ERROR,
title = context.getString(R.string.wallet__ldk_sync_error_title),
description = context.getString(R.string.wallet__ldk_sync_error_body),
)
return@onFailure
}
ToastEventBus.send(it)
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,7 @@
<string name="wallet__filter_title">Select Range</string>
<string name="wallet__instant_payment_received">Received Instant Bitcoin</string>
<string name="wallet__ldk_start_error_title">Lightning Startup Error</string>
<string name="wallet__ldk_sync_error_body">Unable to sync with the network. Please try again later.</string>
<string name="wallet__ldk_sync_error_title">Lightning Sync Error</string>
<string name="wallet__lnurl_p_max">Maximum amount</string>
<string name="wallet__lnurl_p_title">Pay Bitcoin</string>
Expand Down
Loading