Skip to content
This repository was archived by the owner on Feb 9, 2026. It is now read-only.

Commit 253959a

Browse files
authored
Merge branch 'master' into native-tx-writes
2 parents d4df7c0 + f0320ae commit 253959a

2 files changed

Lines changed: 34 additions & 29 deletions

File tree

lib/ios/Classes/LdkChannelManagerPersister.swift

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -294,18 +294,20 @@ class LdkChannelManagerPersister: Persister, ExtendedChannelManagerPersister {
294294
}
295295

296296
override func persistScorer(scorer: WriteableScore) -> Bindings.Result_NoneErrorZ {
297-
guard let scorerStorage = Ldk.accountStoragePath?.appendingPathComponent(LdkFileNames.scorer.rawValue) else {
298-
return Result_NoneErrorZ.initWithErr(e: .Other)
299-
}
297+
return Result_NoneErrorZ.initWithOk()
300298

301-
do {
302-
try Data(scorer.write()).write(to: scorerStorage)
303-
304-
return Result_NoneErrorZ.initWithOk()
305-
} catch {
306-
LdkEventEmitter.shared.send(withEvent: .native_log, body: "Error. Failed to persist scorer to disk Error \(error.localizedDescription).")
307-
return Result_NoneErrorZ.initWithErr(e: .Other)
308-
}
299+
// guard let scorerStorage = Ldk.accountStoragePath?.appendingPathComponent(LdkFileNames.scorer.rawValue) else {
300+
// return Result_NoneErrorZ.initWithErr(e: .Other)
301+
// }
302+
//
303+
// do {
304+
// try Data(scorer.write()).write(to: scorerStorage)
305+
//
306+
// return Result_NoneErrorZ.initWithOk()
307+
// } catch {
308+
// LdkEventEmitter.shared.send(withEvent: .native_log, body: "Error. Failed to persist scorer to disk Error \(error.localizedDescription).")
309+
// return Result_NoneErrorZ.initWithErr(e: .Other)
310+
// }
309311
}
310312

311313
/// Saves claiming/claimed payment to disk. If payment hash exists already then the payment values are merged into the existing entry as an update

lib/ios/Helpers.swift

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,28 @@ func currencyString(_ currency: Currency) -> String {
5252
func getProbabilisticScorer(path: URL, networkGraph: NetworkGraph, logger: LdkLogger) -> ProbabilisticScorer {
5353
let scoringParams = ProbabilisticScoringParameters.initWithDefault()
5454

55-
var probabalisticScorer: ProbabilisticScorer?
56-
if let storedScorer = try? Data(contentsOf: path.appendingPathComponent(LdkFileNames.scorer.rawValue).standardizedFileURL) {
57-
let scorerRead = ProbabilisticScorer.read(ser: [UInt8](storedScorer), argA: scoringParams, argB: networkGraph, argC: logger)
58-
59-
if scorerRead.isOk() {
60-
LdkEventEmitter.shared.send(withEvent: .native_log, body: "Loaded scorer from disk")
61-
probabalisticScorer = scorerRead.getValue()
62-
} else {
63-
LdkEventEmitter.shared.send(withEvent: .native_log, body: "Failed to load cached scorer")
64-
}
65-
}
66-
67-
//Doesn't exist or error reading it
68-
if probabalisticScorer == nil {
69-
LdkEventEmitter.shared.send(withEvent: .native_log, body: "Starting scorer from scratch")
70-
probabalisticScorer = ProbabilisticScorer(params: scoringParams, networkGraph: networkGraph, logger: logger)
71-
}
55+
//TODO remove below line and uncomment below to enable reading cached scorer again
56+
return ProbabilisticScorer(params: scoringParams, networkGraph: networkGraph, logger: logger)
7257

73-
return probabalisticScorer!
58+
// var probabalisticScorer: ProbabilisticScorer?
59+
// if let storedScorer = try? Data(contentsOf: path.appendingPathComponent(LdkFileNames.scorer.rawValue).standardizedFileURL) {
60+
// let scorerRead = ProbabilisticScorer.read(ser: [UInt8](storedScorer), argA: scoringParams, argB: networkGraph, argC: logger)
61+
//
62+
// if scorerRead.isOk() {
63+
// LdkEventEmitter.shared.send(withEvent: .native_log, body: "Loaded scorer from disk")
64+
// probabalisticScorer = scorerRead.getValue()
65+
// } else {
66+
// LdkEventEmitter.shared.send(withEvent: .native_log, body: "Failed to load cached scorer")
67+
// }
68+
// }
69+
//
70+
// //Doesn't exist or error reading it
71+
// if probabalisticScorer == nil {
72+
// LdkEventEmitter.shared.send(withEvent: .native_log, body: "Starting scorer from scratch")
73+
// probabalisticScorer = ProbabilisticScorer(params: scoringParams, networkGraph: networkGraph, logger: logger)
74+
// }
75+
//
76+
// return probabalisticScorer!
7477
}
7578

7679
extension Invoice {

0 commit comments

Comments
 (0)