diff --git a/LDKNodeMonday.xcodeproj/project.pbxproj b/LDKNodeMonday.xcodeproj/project.pbxproj index 1764d45..8de3a99 100644 --- a/LDKNodeMonday.xcodeproj/project.pbxproj +++ b/LDKNodeMonday.xcodeproj/project.pbxproj @@ -919,7 +919,7 @@ repositoryURL = "https://github.com/lightningdevkit/ldk-node.git"; requirement = { kind = exactVersion; - version = 0.6.1; + version = 0.6.2; }; }; AE01C5AE2AB3BEED00F28C7E /* XCRemoteSwiftPackageReference "KeychainAccess" */ = { diff --git a/LDKNodeMonday.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/LDKNodeMonday.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a9c96d8..98e735b 100644 --- a/LDKNodeMonday.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/LDKNodeMonday.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -33,8 +33,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/lightningdevkit/ldk-node.git", "state" : { - "revision" : "93858b372c7b450fc90b86d362facd79fe823e45", - "version" : "0.6.1" + "revision" : "0b999773fa54a3c54f007bebccdceb1fa67247fe", + "version" : "0.6.2" } }, { diff --git a/LDKNodeMonday/App/WalletClient.swift b/LDKNodeMonday/App/WalletClient.swift index 769de06..27f483c 100644 --- a/LDKNodeMonday/App/WalletClient.swift +++ b/LDKNodeMonday/App/WalletClient.swift @@ -61,14 +61,15 @@ public class WalletClient { await MainActor.run { self.network = lightningClient.getNetwork() self.server = lightningClient.getServer() - + // Load LSP from keychain if available if let savedLSPNodeId = try? self.keyClient.getLSP(), - !savedLSPNodeId.isEmpty, - let savedLSP = LightningServiceProvider.getByNodeId(savedLSPNodeId) { + !savedLSPNodeId.isEmpty, + let savedLSP = LightningServiceProvider.getByNodeId(savedLSPNodeId) + { self.lsp = savedLSP } - + self.appState = .wallet } } catch let error { diff --git a/LDKNodeMonday/Extensions/UInt64+Extensions.swift b/LDKNodeMonday/Extensions/UInt64+Extensions.swift index 69f0e83..d606368 100644 --- a/LDKNodeMonday/Extensions/UInt64+Extensions.swift +++ b/LDKNodeMonday/Extensions/UInt64+Extensions.swift @@ -63,18 +63,18 @@ extension UInt64 { numberFormatter.usesGroupingSeparator = true numberFormatter.groupingSeparator = "," numberFormatter.generatesDecimalNumbers = false - + return numberFormatter } - + func formattedBip177() -> String { if self != .zero && self >= 1_000_000 && self % 1_000_000 == .zero { return "\(self / 1_000_000)M" - + } else if self != .zero && self % 1_000 == 0 { return "\(self / 1_000)K" } - + return numberFormatter.string(from: NSNumber(value: self)) ?? "0" } } diff --git a/LDKNodeMonday/Service/Lightning Service/LightningNodeService.swift b/LDKNodeMonday/Service/Lightning Service/LightningNodeService.swift index ee7dc37..9cb6643 100644 --- a/LDKNodeMonday/Service/Lightning Service/LightningNodeService.swift +++ b/LDKNodeMonday/Service/Lightning Service/LightningNodeService.swift @@ -96,10 +96,13 @@ class LightningNodeService { config.network = self.network config.trustedPeers0conf = [self.lsp.nodeId] // config.logLevel = .trace - - // Faster sync intervals for better balance updates - config.onchainWalletSyncIntervalSecs = 20 // Default: 80 seconds - config.lightningWalletSyncIntervalSecs = 10 // Default: 30 seconds + + // Faster sync intervals for better balance updates (moved under EsploraSyncConfig) + let backgroundSync = BackgroundSyncConfig( + onchainWalletSyncIntervalSecs: 20, // Default: 80 seconds + lightningWalletSyncIntervalSecs: 10, // Default: 30 seconds + feeRateCacheUpdateIntervalSecs: 600 // Default: 600 seconds + ) let anchor_cfg = AnchorChannelsConfig( trustedPeersNoReserve: [self.lsp.nodeId], @@ -108,7 +111,11 @@ class LightningNodeService { config.anchorChannelsConfig = .some(anchor_cfg) let nodeBuilder = Builder.fromConfig(config: config) - nodeBuilder.setChainSourceEsplora(serverUrl: self.server.url, config: nil) + // Enable filesystem logging + let logFilePath = logPath + "/ldk-node.log" + nodeBuilder.setFilesystemLogger(logFilePath: logFilePath, maxLogLevel: .trace) + let esploraSyncConfig = EsploraSyncConfig(backgroundSyncConfig: .some(backgroundSync)) + nodeBuilder.setChainSourceEsplora(serverUrl: self.server.url, config: esploraSyncConfig) switch self.network { case .bitcoin: @@ -394,7 +401,7 @@ extension LightningNodeService { } } } - + func syncWallets() throws { try self.ldkNode.syncWallets() } diff --git a/LDKNodeMonday/View Model/Home/Receive/ReceiveViewModel.swift b/LDKNodeMonday/View Model/Home/Receive/ReceiveViewModel.swift index e51f584..3a33760 100644 --- a/LDKNodeMonday/View Model/Home/Receive/ReceiveViewModel.swift +++ b/LDKNodeMonday/View Model/Home/Receive/ReceiveViewModel.swift @@ -35,7 +35,8 @@ class ReceiveViewModel: ObservableObject { self.addressGenerationStatus = .generating } let receiveCapacity = maxReceiveCapacity() - let needsJIT = amountSat.satsAsMsats > receiveCapacity || (amountSat == 0 && receiveCapacity == 0) + let needsJIT = + amountSat.satsAsMsats > receiveCapacity || (amountSat == 0 && receiveCapacity == 0) if needsJIT { // Generate onchain and bolt11Jit, create BIP21 from those let addresses = await generateUnifiedWithJIT() @@ -105,7 +106,8 @@ class ReceiveViewModel: ObservableObject { // Bolt11 let receiveCapacity = maxReceiveCapacity() - let needsJIT = amountSat.satsAsMsats > receiveCapacity || (amountSat == 0 && receiveCapacity == 0) + let needsJIT = + amountSat.satsAsMsats > receiveCapacity || (amountSat == 0 && receiveCapacity == 0) // Always try to generate bolt11 invoice // The needsJIT flag will handle JIT channel creation when capacity is insufficient