@@ -2198,7 +2198,13 @@ impl<Signer: Sign> Channel<Signer> {
2198
2198
& self . get_counterparty_pubkeys ( ) . funding_pubkey
2199
2199
}
2200
2200
2201
- pub fn funding_created < L : Deref > ( & mut self , msg : & msgs:: FundingCreated , best_block : BestBlock , logger : & L ) -> Result < ( msgs:: FundingSigned , ChannelMonitor < Signer > , Option < msgs:: ChannelReady > ) , ChannelError > where L :: Target : Logger {
2201
+ pub fn funding_created < K : Deref , L : Deref > (
2202
+ & mut self , msg : & msgs:: FundingCreated , best_block : BestBlock , keys_source : & K , logger : & L
2203
+ ) -> Result < ( msgs:: FundingSigned , ChannelMonitor < <K :: Target as KeysInterface >:: Signer > , Option < msgs:: ChannelReady > ) , ChannelError >
2204
+ where
2205
+ K :: Target : KeysInterface ,
2206
+ L :: Target : Logger
2207
+ {
2202
2208
if self . is_outbound ( ) {
2203
2209
return Err ( ChannelError :: Close ( "Received funding_created for an outbound channel?" . to_owned ( ) ) ) ;
2204
2210
}
@@ -2253,7 +2259,9 @@ impl<Signer: Sign> Channel<Signer> {
2253
2259
let funding_txo_script = funding_redeemscript. to_v0_p2wsh ( ) ;
2254
2260
let obscure_factor = get_commitment_transaction_number_obscure_factor ( & self . get_holder_pubkeys ( ) . payment_point , & self . get_counterparty_pubkeys ( ) . payment_point , self . is_outbound ( ) ) ;
2255
2261
let shutdown_script = self . shutdown_scriptpubkey . clone ( ) . map ( |script| script. into_inner ( ) ) ;
2256
- let channel_monitor = ChannelMonitor :: new ( self . secp_ctx . clone ( ) , self . holder_signer . clone ( ) ,
2262
+ let mut monitor_signer = keys_source. derive_channel_signer ( self . channel_value_satoshis , self . channel_keys_id ) ;
2263
+ monitor_signer. provide_channel_parameters ( & self . channel_transaction_parameters ) ;
2264
+ let channel_monitor = ChannelMonitor :: new ( self . secp_ctx . clone ( ) , monitor_signer,
2257
2265
shutdown_script, self . get_holder_selected_contest_delay ( ) ,
2258
2266
& self . destination_script , ( funding_txo, funding_txo_script. clone ( ) ) ,
2259
2267
& self . channel_transaction_parameters ,
@@ -2278,7 +2286,13 @@ impl<Signer: Sign> Channel<Signer> {
2278
2286
2279
2287
/// Handles a funding_signed message from the remote end.
2280
2288
/// If this call is successful, broadcast the funding transaction (and not before!)
2281
- pub fn funding_signed < L : Deref > ( & mut self , msg : & msgs:: FundingSigned , best_block : BestBlock , logger : & L ) -> Result < ( ChannelMonitor < Signer > , Transaction , Option < msgs:: ChannelReady > ) , ChannelError > where L :: Target : Logger {
2289
+ pub fn funding_signed < K : Deref , L : Deref > (
2290
+ & mut self , msg : & msgs:: FundingSigned , best_block : BestBlock , keys_source : & K , logger : & L
2291
+ ) -> Result < ( ChannelMonitor < <K :: Target as KeysInterface >:: Signer > , Transaction , Option < msgs:: ChannelReady > ) , ChannelError >
2292
+ where
2293
+ K :: Target : KeysInterface ,
2294
+ L :: Target : Logger
2295
+ {
2282
2296
if !self . is_outbound ( ) {
2283
2297
return Err ( ChannelError :: Close ( "Received funding_signed for an inbound channel?" . to_owned ( ) ) ) ;
2284
2298
}
@@ -2330,7 +2344,9 @@ impl<Signer: Sign> Channel<Signer> {
2330
2344
let funding_txo_script = funding_redeemscript. to_v0_p2wsh ( ) ;
2331
2345
let obscure_factor = get_commitment_transaction_number_obscure_factor ( & self . get_holder_pubkeys ( ) . payment_point , & self . get_counterparty_pubkeys ( ) . payment_point , self . is_outbound ( ) ) ;
2332
2346
let shutdown_script = self . shutdown_scriptpubkey . clone ( ) . map ( |script| script. into_inner ( ) ) ;
2333
- let channel_monitor = ChannelMonitor :: new ( self . secp_ctx . clone ( ) , self . holder_signer . clone ( ) ,
2347
+ let mut monitor_signer = keys_source. derive_channel_signer ( self . channel_value_satoshis , self . channel_keys_id ) ;
2348
+ monitor_signer. provide_channel_parameters ( & self . channel_transaction_parameters ) ;
2349
+ let channel_monitor = ChannelMonitor :: new ( self . secp_ctx . clone ( ) , monitor_signer,
2334
2350
shutdown_script, self . get_holder_selected_contest_delay ( ) ,
2335
2351
& self . destination_script , ( funding_txo, funding_txo_script) ,
2336
2352
& self . channel_transaction_parameters ,
@@ -7058,10 +7074,10 @@ mod tests {
7058
7074
} ] } ;
7059
7075
let funding_outpoint = OutPoint { txid : tx. txid ( ) , index : 0 } ;
7060
7076
let funding_created_msg = node_a_chan. get_outbound_funding_created ( tx. clone ( ) , funding_outpoint, & & logger) . unwrap ( ) ;
7061
- let ( funding_signed_msg, _, _) = node_b_chan. funding_created ( & funding_created_msg, best_block, & & logger) . unwrap ( ) ;
7077
+ let ( funding_signed_msg, _, _) = node_b_chan. funding_created ( & funding_created_msg, best_block, & & keys_provider , & & logger) . unwrap ( ) ;
7062
7078
7063
7079
// Node B --> Node A: funding signed
7064
- let _ = node_a_chan. funding_signed ( & funding_signed_msg, best_block, & & logger) ;
7080
+ let _ = node_a_chan. funding_signed ( & funding_signed_msg, best_block, & & keys_provider , & & logger) ;
7065
7081
7066
7082
// Now disconnect the two nodes and check that the commitment point in
7067
7083
// Node B's channel_reestablish message is sane.
0 commit comments