@@ -40,6 +40,7 @@ public class ChannelManagerConstructor: NativeTypeWrapper {
40
40
fileprivate var scorer : MultiThreadedLockableScore ?
41
41
fileprivate let keysInterface : KeysInterface !
42
42
public private( set) var payer : InvoicePayer ?
43
+ fileprivate var payerRetries : Retry !
43
44
public let peerManager : PeerManager
44
45
private var tcpPeerHandler : TCPPeerHandler ?
45
46
@@ -54,7 +55,7 @@ public class ChannelManagerConstructor: NativeTypeWrapper {
54
55
private let chain_monitor : ChainMonitor
55
56
56
57
57
- public init ( channelManagerSerialized: [ UInt8 ] , channelMonitorsSerialized: [ [ UInt8 ] ] , keysInterface: KeysInterface , feeEstimator: FeeEstimator , chainMonitor: ChainMonitor , filter: Filter ? , netGraphSerialized: [ UInt8 ] ? , txBroadcaster: BroadcasterInterface , logger: Logger , enableP2PGossip: Bool = false ) throws {
58
+ public init ( channelManagerSerialized: [ UInt8 ] , channelMonitorsSerialized: [ [ UInt8 ] ] , keysInterface: KeysInterface , feeEstimator: FeeEstimator , chainMonitor: ChainMonitor , filter: Filter ? , netGraphSerialized: [ UInt8 ] ? , txBroadcaster: BroadcasterInterface , logger: Logger , enableP2PGossip: Bool = false , userConfig : UserConfig = UserConfig . initWithDefault ( ) , payerRetries : Retry = Retry . initWithAttempts ( a : UInt ( 3 ) ) ) throws {
58
59
59
60
var monitors : [ ChannelMonitor ] = [ ]
60
61
self . channel_monitors = [ ]
@@ -83,8 +84,7 @@ public class ChannelManagerConstructor: NativeTypeWrapper {
83
84
}
84
85
85
86
print ( " Collected channel monitors, reading channel manager " )
86
- let channelManagerReadArgs = ChannelManagerReadArgs ( keysManager: keysInterface, feeEstimator: feeEstimator, chainMonitor: chainMonitor. asWatch ( ) , txBroadcaster: txBroadcaster, logger: logger, defaultConfig: UserConfig . initWithDefault ( ) , channelMonitors: monitors)
87
-
87
+ let channelManagerReadArgs = ChannelManagerReadArgs ( keysManager: keysInterface, feeEstimator: feeEstimator, chainMonitor: chainMonitor. asWatch ( ) , txBroadcaster: txBroadcaster, logger: logger, defaultConfig: userConfig, channelMonitors: monitors)
88
88
89
89
guard let ( latestBlockHash, channelManager) = Bindings . readBlockHashChannelManager ( ser: channelManagerSerialized, arg: channelManagerReadArgs) . getValue ( ) else {
90
90
throw InvalidSerializedDataError . invalidSerializedChannelManager
@@ -99,6 +99,7 @@ public class ChannelManagerConstructor: NativeTypeWrapper {
99
99
self . channel_manager_latest_block_hash = latestBlockHash
100
100
self . chain_monitor = chainMonitor
101
101
self . keysInterface = keysInterface
102
+ self . payerRetries = payerRetries
102
103
self . logger = logger
103
104
104
105
let random_data = keysInterface. getSecureRandomBytes ( ) ;
@@ -143,14 +144,15 @@ public class ChannelManagerConstructor: NativeTypeWrapper {
143
144
/**
144
145
* Constructs a channel manager from the given interface implementations
145
146
*/
146
- public init ( network: Network , config : UserConfig , currentBlockchainTipHash: [ UInt8 ] , currentBlockchainTipHeight: UInt32 , keysInterface: KeysInterface , feeEstimator: FeeEstimator , chainMonitor: ChainMonitor , netGraph: NetworkGraph ? , txBroadcaster: BroadcasterInterface , logger: Logger , enableP2PGossip: Bool = false ) {
147
+ public init ( network: Network , userConfig : UserConfig , currentBlockchainTipHash: [ UInt8 ] , currentBlockchainTipHeight: UInt32 , keysInterface: KeysInterface , feeEstimator: FeeEstimator , chainMonitor: ChainMonitor , netGraph: NetworkGraph ? , txBroadcaster: BroadcasterInterface , logger: Logger , enableP2PGossip: Bool = false , payerRetries : Retry = Retry . initWithAttempts ( a : UInt ( 3 ) ) ) {
147
148
148
149
self . channel_monitors = [ ]
149
150
self . channel_manager_latest_block_hash = nil
150
151
self . chain_monitor = chainMonitor
151
152
let block = BestBlock ( blockHash: currentBlockchainTipHash, height: currentBlockchainTipHeight)
152
153
let chainParameters = ChainParameters ( networkArg: network, bestBlockArg: block)
153
- self . channelManager = ChannelManager ( feeEst: feeEstimator, chainMonitor: chainMonitor. asWatch ( ) , txBroadcaster: txBroadcaster, logger: logger, keysManager: keysInterface, config: config, params: chainParameters)
154
+ self . channelManager = ChannelManager ( feeEst: feeEstimator, chainMonitor: chainMonitor. asWatch ( ) , txBroadcaster: txBroadcaster, logger: logger, keysManager: keysInterface, config: userConfig, params: chainParameters)
155
+ self . payerRetries = payerRetries
154
156
self . logger = logger
155
157
156
158
self . keysInterface = keysInterface
@@ -215,7 +217,7 @@ public class ChannelManagerConstructor: NativeTypeWrapper {
215
217
// either dangle router, or set is_owned to false
216
218
// scorer.cType!.is_owned = false
217
219
// router.cType!.is_owned = false
218
- self . payer = InvoicePayer ( payer: self . channelManager. asPayer ( ) , router: router. asRouter ( ) , logger: self . logger, eventHandler: self . customEventHandler!, retry: Retry . initWithAttempts ( a : UInt ( 3 ) ) )
220
+ self . payer = InvoicePayer ( payer: self . channelManager. asPayer ( ) , router: router. asRouter ( ) , logger: self . logger, eventHandler: self . customEventHandler!, retry: self . payerRetries )
219
221
// router.cType!.is_owned = true
220
222
self . customEventHandler = self . payer!. asEventHandler ( )
221
223
}
0 commit comments