@@ -282,8 +282,7 @@ class WalletViewModel: ObservableObject {
282282 " Found \( migration. channelMonitors. count) monitors on RN backup for pre-startup recovery " ,
283283 context: " WalletViewModel "
284284 )
285- let filtered = filterMigrationMonitors ( migration, walletIndex: walletIndex)
286- return ( filtered, allRetrieved)
285+ return ( migration, allRetrieved)
287286 } else {
288287 Logger . info ( " No channel monitors found on RN backup " , context: " WalletViewModel " )
289288 return ( nil , allRetrieved)
@@ -294,56 +293,6 @@ class WalletViewModel: ObservableObject {
294293 }
295294 }
296295
297- /// Filters out migration monitors for channels that already have local monitors.
298- /// Prevents old RN monitors from overwriting newer local ones during orphaned channel recovery.
299- private func filterMigrationMonitors( _ migration: PendingChannelMigration , walletIndex: Int ) -> PendingChannelMigration ? {
300- let monitorsDir = Env . ldkStorage ( walletIndex: walletIndex)
301- . appendingPathComponent ( " channel_monitors " )
302- . appendingPathComponent ( " 0 " )
303-
304- guard FileManager . default. fileExists ( atPath: monitorsDir. path) else {
305- Logger . debug ( " No local monitors directory, keeping all migration monitors " , context: " WalletViewModel " )
306- return migration
307- }
308-
309- let localFiles = ( try ? FileManager . default. contentsOfDirectory ( atPath: monitorsDir. path) ) ?? [ ]
310- guard !localFiles. isEmpty else {
311- Logger . debug ( " No local monitor files, keeping all migration monitors " , context: " WalletViewModel " )
312- return migration
313- }
314-
315- let localMonitorIds = Set ( localFiles)
316- var filteredMonitors : [ Data ] = [ ]
317- var filteredIds : [ String ] = [ ]
318-
319- for (index, monitorId) in migration. channelMonitorIds. enumerated ( ) {
320- if localMonitorIds. contains ( monitorId) {
321- Logger . info ( " Skipping migration monitor \( monitorId) — already exists locally " , context: " WalletViewModel " )
322- } else {
323- filteredMonitors. append ( migration. channelMonitors [ index] )
324- filteredIds. append ( monitorId)
325- }
326- }
327-
328- if filteredMonitors. isEmpty {
329- Logger . info (
330- " All \( migration. channelMonitors. count) migration monitors already exist locally, skipping migration " ,
331- context: " WalletViewModel "
332- )
333- return nil
334- }
335-
336- Logger . info (
337- " Filtered migration monitors: \( filteredMonitors. count) kept, \( migration. channelMonitors. count - filteredMonitors. count) skipped (already local) " ,
338- context: " WalletViewModel "
339- )
340- return PendingChannelMigration (
341- channelManager: migration. channelManager,
342- channelMonitors: filteredMonitors,
343- channelMonitorIds: filteredIds
344- )
345- }
346-
347296 private func fetchTrustedPeersFromBlocktank( ) async -> [ LnPeer ] ? {
348297 switch Self . peerSimulation {
349298 case . apiFailure:
0 commit comments