From 2caebd1499fac26d894afc26896bdff824c17272 Mon Sep 17 00:00:00 2001 From: Joao Victor Sena Date: Mon, 28 Oct 2024 18:29:46 -0300 Subject: [PATCH] fix: try catch --- .../floresta/domain/bitcoin/WalletManager.kt | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/github/jvsena42/floresta/domain/bitcoin/WalletManager.kt b/app/src/main/java/com/github/jvsena42/floresta/domain/bitcoin/WalletManager.kt index 442dbec..26b0100 100644 --- a/app/src/main/java/com/github/jvsena42/floresta/domain/bitcoin/WalletManager.kt +++ b/app/src/main/java/com/github/jvsena42/floresta/domain/bitcoin/WalletManager.kt @@ -186,14 +186,18 @@ class WalletManager( fullScan() } else { Log.d(TAG, "sync: normal sync") - val syncRequest = wallet.startSyncWithRevealedSpks().build() - val update = blockchainClient.sync( - syncRequest = syncRequest, - batchSize = 100u, - fetchPrevTxouts = true - ) - wallet.applyUpdate(update) - wallet.persist(dbConnection) + try { + val syncRequest = wallet.startSyncWithRevealedSpks().build() + val update = blockchainClient.sync( + syncRequest = syncRequest, + batchSize = 100u, + fetchPrevTxouts = true + ) + wallet.applyUpdate(update) + wallet.persist(dbConnection) + } catch (e: Exception) { + Log.e(TAG, "sync error: ", e) + } } }