Skip to content

Commit 22d8bb0

Browse files
committed
fix: reenable orphaned channel recovery
1 parent 165b7b1 commit 22d8bb0

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

Bitkit/ViewModels/WalletViewModel.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,20 +138,20 @@ class WalletViewModel: ObservableObject {
138138
}
139139

140140
// If no local migration data, try fetching from RN remote backup (one-time)
141-
// if channelMigration == nil {
142-
// let (remoteMigration, allRetrieved) = await fetchOrphanedChannelMonitorsIfNeeded(walletIndex: walletIndex)
143-
// if let remoteMigration {
144-
// channelMigration = ChannelDataMigration(
145-
// // don't overwrite channel manager, we only need the monitors for the sweep
146-
// channelManager: nil,
147-
// channelMonitors: remoteMigration.channelMonitors.map { [UInt8]($0) }
148-
// )
149-
// MigrationsService.shared.pendingChannelMigration = nil
150-
// }
151-
// if allRetrieved {
152-
// MigrationsService.shared.isChannelRecoveryChecked = true
153-
// }
154-
// }
141+
if channelMigration == nil {
142+
let (remoteMigration, allRetrieved) = await fetchOrphanedChannelMonitorsIfNeeded(walletIndex: walletIndex)
143+
if let remoteMigration {
144+
channelMigration = ChannelDataMigration(
145+
// don't overwrite channel manager, we only need the monitors for the sweep
146+
channelManager: nil,
147+
channelMonitors: remoteMigration.channelMonitors.map { [UInt8]($0) }
148+
)
149+
MigrationsService.shared.pendingChannelMigration = nil
150+
}
151+
if allRetrieved {
152+
MigrationsService.shared.isChannelRecoveryChecked = true
153+
}
154+
}
155155

156156
await runLegacyNetworkGraphCleanupIfNeeded()
157157

@@ -257,7 +257,7 @@ class WalletViewModel: ObservableObject {
257257
/// Returns (migration data if found, whether all monitors were successfully retrieved).
258258
private func fetchOrphanedChannelMonitorsIfNeeded(walletIndex: Int) async -> (PendingChannelMigration?, Bool) {
259259
let migrations = MigrationsService.shared
260-
guard !migrations.isChannelRecoveryChecked else { return (nil, true) }
260+
// guard !migrations.isChannelRecoveryChecked else { return (nil, true) }
261261

262262
Logger.info("Running pre-startup channel monitor recovery check", context: "WalletViewModel")
263263

0 commit comments

Comments
 (0)