@@ -42,10 +42,11 @@ public struct ChannelManagerConstructionParameters {
42
42
public var txBroadcaster : BroadcasterInterface
43
43
public var enableP2PGossip : Bool = false
44
44
public var scorer : MultiThreadedLockableScore ?
45
+ public var scoreParams : ProbabilisticScoringFeeParameters ?
45
46
public var payerRetries : Retry = Retry . initWithAttempts ( a: UInt ( 3 ) )
46
47
public var logger : Logger
47
48
48
- public init ( config: UserConfig , entropySource: EntropySource , nodeSigner: NodeSigner , signerProvider: SignerProvider , feeEstimator: FeeEstimator , chainMonitor: ChainMonitor , txBroadcaster: BroadcasterInterface , logger: Logger , enableP2PGossip: Bool = false , scorer: MultiThreadedLockableScore ? = nil , payerRetries: Retry = Retry . initWithAttempts ( a: UInt ( 3 ) ) ) {
49
+ public init ( config: UserConfig , entropySource: EntropySource , nodeSigner: NodeSigner , signerProvider: SignerProvider , feeEstimator: FeeEstimator , chainMonitor: ChainMonitor , txBroadcaster: BroadcasterInterface , logger: Logger , enableP2PGossip: Bool = false , scorer: MultiThreadedLockableScore ? = nil , scoreParams : ProbabilisticScoringFeeParameters ? = nil , payerRetries: Retry = Retry . initWithAttempts ( a: UInt ( 3 ) ) ) {
49
50
self . config = config
50
51
self . entropySource = entropySource
51
52
self . nodeSigner = nodeSigner
@@ -57,6 +58,11 @@ public struct ChannelManagerConstructionParameters {
57
58
58
59
self . enableP2PGossip = enableP2PGossip
59
60
self . scorer = scorer
61
+ if scorer != nil && scoreParams == nil {
62
+ self . scoreParams = ProbabilisticScoringFeeParameters . initWithDefault ( )
63
+ } else {
64
+ self . scoreParams = scoreParams
65
+ }
60
66
self . payerRetries = payerRetries
61
67
}
62
68
@@ -74,8 +80,8 @@ public struct ChannelManagerConstructionParameters {
74
80
}
75
81
76
82
fileprivate func router( networkGraph: NetworkGraph ? ) -> Router {
77
- if let netGraph = networkGraph, let scorer = self . scorer {
78
- return DefaultRouter ( networkGraph: netGraph, logger: self . logger, randomSeedBytes: self . entropySource. getSecureRandomBytes ( ) , scorer: scorer. asLockableScore ( ) ) . asRouter ( )
83
+ if let netGraph = networkGraph, let scorer = self . scorer, let scoreParams = self . scoreParams {
84
+ return DefaultRouter ( networkGraph: netGraph, logger: self . logger, randomSeedBytes: self . entropySource. getSecureRandomBytes ( ) , scorer: scorer. asLockableScore ( ) , scoreParams : scoreParams ) . asRouter ( )
79
85
}
80
86
return CMCRouter ( )
81
87
}
0 commit comments