@@ -46,7 +46,6 @@ import kotlinx.coroutines.flow.update
4646import kotlinx.coroutines.launch
4747import kotlinx.coroutines.withContext
4848import kotlinx.coroutines.withTimeout
49- import org.lightningdevkit.ldknode.ChannelDataMigration
5049import org.lightningdevkit.ldknode.Event
5150import org.lightningdevkit.ldknode.PaymentId
5251import org.lightningdevkit.ldknode.SpendableUtxo
@@ -359,14 +358,6 @@ class AppViewModel @Inject constructor(
359358 migrationService.setShowingMigrationLoading(false )
360359 }
361360
362- private fun buildChannelMigrationIfAvailable (): ChannelDataMigration ? {
363- val migration = migrationService.peekPendingChannelMigration() ? : return null
364- return ChannelDataMigration (
365- channelManager = migration.channelManager.map { it.toUByte() },
366- channelMonitors = migration.channelMonitors.map { monitor -> monitor.map { it.toUByte() } },
367- )
368- }
369-
370361 private suspend fun completeMigration () {
371362 if (isCompletingMigration) return
372363 isCompletingMigration = true
@@ -379,26 +370,13 @@ class AppViewModel @Inject constructor(
379370 }
380371 activityRepo.markAllUnseenActivitiesAsSeen()
381372
382- val channelMigration = buildChannelMigrationIfAvailable()
383- lightningRepo.stop().onFailure {
384- Logger .error(" Failed to stop node during migration restart" , it, context = TAG )
385- }
386- delay(MIGRATION_NODE_RESTART_DELAY_MS )
387- lightningRepo.start(channelMigration = channelMigration, shouldRetry = false )
388- .onSuccess {
389- migrationService.consumePendingChannelMigration()
390- walletRepo.syncNodeAndWallet()
391- .onSuccess {
392- finishMigrationSuccessfully()
393- }
394- .onFailure { e ->
395- Logger .warn(" Sync failed after restart during migration: $e " , e, context = TAG )
396- finishMigrationWithFallbackSync()
397- }
398- }
373+ migrationService.consumePendingChannelMigration()
374+
375+ walletRepo.syncNodeAndWallet()
376+ .onSuccess { finishMigrationSuccessfully() }
399377 .onFailure { e ->
400- Logger .error( " Failed to restart node after migration: $e " , e, context = TAG )
401- finishMigrationWithError ()
378+ Logger .warn( " Sync failed during migration: $e " , e, context = TAG )
379+ finishMigrationWithFallbackSync ()
402380 }
403381 } catch (e: Exception ) {
404382 Logger .error(" Migration completion error: $e " , e, context = TAG )
@@ -1992,7 +1970,6 @@ class AppViewModel @Inject constructor(
19921970 private const val MAX_FEE_AMOUNT_RATIO = 0.5
19931971 private const val SCREEN_TRANSITION_DELAY_MS = 300L
19941972 private const val MIGRATION_LOADING_TIMEOUT_MS = 300_000L
1995- private const val MIGRATION_NODE_RESTART_DELAY_MS = 500L
19961973 private const val MIGRATION_AUTH_RESET_DELAY_MS = 500L
19971974 private const val AUTH_CHECK_INITIAL_DELAY_MS = 1000L
19981975 private const val AUTH_CHECK_SPLASH_DELAY_MS = 500L
0 commit comments