File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
app/src/main/java/to/bitkit Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -128,3 +128,7 @@ class LdkError(private val inner: LdkException) : AppError("Unknown LDK error.")
128128 }
129129}
130130// endregion
131+
132+ /* * Check if the throwable is a TxSyncTimeout exception. */
133+ fun Throwable.isTxSyncTimeout (): Boolean =
134+ this is NodeException .TxSyncTimeout || cause is NodeException .TxSyncTimeout
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import to.bitkit.repositories.WalletRepo
3131import to.bitkit.ui.onboarding.LOADING_MS
3232import to.bitkit.ui.shared.toast.ToastEventBus
3333import to.bitkit.utils.Logger
34+ import to.bitkit.utils.isTxSyncTimeout
3435import javax.inject.Inject
3536import kotlin.coroutines.cancellation.CancellationException
3637import kotlin.time.Duration.Companion.milliseconds
@@ -168,8 +169,8 @@ class WalletViewModel @Inject constructor(
168169 fun refreshState () = viewModelScope.launch {
169170 walletRepo.syncNodeAndWallet()
170171 .onFailure { error ->
171- if (error is CancellationException ) return @onFailure
172172 Logger .error(" Failed to refresh state: ${error.message} " , error)
173+ if (error is CancellationException || error.isTxSyncTimeout()) return @onFailure
173174 ToastEventBus .send(error)
174175 }
175176 }
You can’t perform that action at this time.
0 commit comments