File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
app/src/main/java/to/bitkit Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -334,6 +334,12 @@ class LightningRepo @Inject constructor(
334334 Result .success(Unit )
335335 }
336336
337+ fun syncAsync () = scope.launch {
338+ sync().onFailure { error ->
339+ Logger .warn(" Sync failed" , e = error, context = TAG )
340+ }
341+ }
342+
337343 /* * Clear pending sync flag. Called when manual pull-to-refresh takes priority. */
338344 fun clearPendingSync () {
339345 syncPending.set(false )
Original file line number Diff line number Diff line change @@ -209,20 +209,16 @@ class BoostTransactionViewModel @Inject constructor(
209209
210210 private suspend fun handleBoostSuccess (newTxId : Txid , isRBF : Boolean ) {
211211 Logger .debug(" Boost successful. newTxId: $newTxId " , context = TAG )
212- updateActivity(newTxId = newTxId, isRBF = isRBF).fold(
213- onSuccess = {
214- lightningRepo.sync()
215- activityRepo.syncActivities()
216- _uiState .update { it.copy(boosting = false ) }
217- setBoostTransactionEffect(BoostTransactionEffects .OnBoostSuccess )
218- },
219- onFailure = { error ->
220- // Boost succeeded but activity update failed - still consider it successful
212+ updateActivity(newTxId = newTxId, isRBF = isRBF)
213+ .onFailure { error ->
221214 Logger .warn(" Boost successful but activity update failed" , e = error, context = TAG )
222- _uiState .update { it.copy(boosting = false ) }
223- setBoostTransactionEffect(BoostTransactionEffects .OnBoostSuccess )
224215 }
225- )
216+
217+ _uiState .update { it.copy(boosting = false ) }
218+ setBoostTransactionEffect(BoostTransactionEffects .OnBoostSuccess )
219+
220+ // Fire-and-forget sync to keep UI responsive even if LDK sync hangs.
221+ lightningRepo.syncAsync()
226222 }
227223
228224 fun onChangeAmount (increase : Boolean ) {
You can’t perform that action at this time.
0 commit comments