Skip to content

Commit 4d4b903

Browse files
authored
Merge branch 'chore/update-deps' into fix/transfer-polish
2 parents e6d7709 + 338f9c0 commit 4d4b903

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/src/main/java/to/bitkit/utils/Errors.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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

app/src/main/java/to/bitkit/viewmodels/WalletViewModel.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import to.bitkit.repositories.WalletRepo
3131
import to.bitkit.ui.onboarding.LOADING_MS
3232
import to.bitkit.ui.shared.toast.ToastEventBus
3333
import to.bitkit.utils.Logger
34+
import to.bitkit.utils.isTxSyncTimeout
3435
import javax.inject.Inject
3536
import kotlin.coroutines.cancellation.CancellationException
3637
import 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
}

0 commit comments

Comments
 (0)