@@ -4818,11 +4818,13 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
48184818 self.get_initial_counterparty_commitment_signature(funding, logger)
48194819 }
48204820
4821- /// Clone, each field, with a few exceptions, notably the channel signer, and
4822- /// a few non-cloneable fields (such as Secp256k1 context)
4821+ /// Clone, each field, with the exception of the channel signer.
48234822 #[allow(unused)]
48244823 fn clone(&self, holder_signer: <SP::Target as SignerProvider>::EcdsaSigner) -> Self {
48254824 Self {
4825+ // Use provided channel signer
4826+ holder_signer: ChannelSignerType::Ecdsa(holder_signer),
4827+
48264828 config: self.config,
48274829 prev_config: self.prev_config,
48284830 inbound_handshake_limits_override: self.inbound_handshake_limits_override,
@@ -4831,12 +4833,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
48314833 temporary_channel_id: self.temporary_channel_id,
48324834 channel_state: self.channel_state,
48334835 announcement_sigs_state: self.announcement_sigs_state.clone(),
4834- // Create new Secp256k context
4835- secp_ctx: Secp256k1::new(),
4836+ secp_ctx: self.secp_ctx.clone(),
48364837 // channel_value_satoshis: self.channel_value_satoshis,
48374838 latest_monitor_update_id: self.latest_monitor_update_id,
4838- // Use provided channel signer
4839- holder_signer: ChannelSignerType::Ecdsa(holder_signer),
48404839 shutdown_scriptpubkey: self.shutdown_scriptpubkey.clone(),
48414840 destination_script: self.destination_script.clone(),
48424841 // holder_commitment_point: self.holder_commitment_point,
@@ -4867,9 +4866,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
48674866 update_time_counter: self.update_time_counter,
48684867 // Create new mutex with copied values
48694868 // #[cfg(debug_assertions)]
4870- // holder_max_commitment_tx_output: Mutex::new(* self.holder_max_commitment_tx_output.lock().unwrap() ),
4869+ // holder_max_commitment_tx_output: self.holder_max_commitment_tx_output.clone( ),
48714870 // #[cfg(debug_assertions)]
4872- // counterparty_max_commitment_tx_output: Mutex::new(* self.counterparty_max_commitment_tx_output.lock().unwrap() ),
4871+ // counterparty_max_commitment_tx_output: self.counterparty_max_commitment_tx_output.clone( ),
48734872 last_sent_closing_fee: self.last_sent_closing_fee.clone(),
48744873 last_received_closing_sig: self.last_received_closing_sig,
48754874 target_closing_feerate_sats_per_kw: self.target_closing_feerate_sats_per_kw,
@@ -4906,9 +4905,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
49064905 announcement_sigs: self.announcement_sigs,
49074906 // Create new mutex with copied values
49084907 // #[cfg(any(test, fuzzing))]
4909- // next_local_commitment_tx_fee_info_cached: Mutex::new( self.next_local_commitment_tx_fee_info_cached.lock().unwrap(). clone() ),
4908+ // next_local_commitment_tx_fee_info_cached: self.next_local_commitment_tx_fee_info_cached.clone(),
49104909 // #[cfg(any(test, fuzzing))]
4911- // next_remote_commitment_tx_fee_info_cached: Mutex::new( self.next_remote_commitment_tx_fee_info_cached.lock().unwrap(). clone() ),
4910+ // next_remote_commitment_tx_fee_info_cached: self.next_remote_commitment_tx_fee_info_cached.clone(),
49124911 workaround_lnd_bug_4006: self.workaround_lnd_bug_4006.clone(),
49134912 sent_message_awaiting_response: self.sent_message_awaiting_response,
49144913 channel_type: self.channel_type.clone(),
0 commit comments