Skip to content

Commit ba9b211

Browse files
committed
fix: when sync in progress, wait for the node sync instead of return success
1 parent 8e2f5f9 commit ba9b211

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/main/java/to/bitkit/repositories/LightningRepo.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,9 @@ class LightningRepo @Inject constructor(
258258
suspend fun sync(): Result<Unit> = executeWhenNodeRunning("Sync") {
259259
syncState()
260260
if (_lightningState.value.isSyncingWallet) {
261-
Logger.warn("Sync already in progress, waiting for existing sync.")
262-
return@executeWhenNodeRunning Result.success(Unit)
261+
Logger.warn("Sync already in progress, waiting for existing sync.", context = TAG)
263262
}
263+
_lightningState.first { !it.isSyncingWallet }
264264

265265
_lightningState.update { it.copy(isSyncingWallet = true) }
266266
lightningService.sync()

0 commit comments

Comments
 (0)