@@ -4818,11 +4818,13 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
4818
4818
self.get_initial_counterparty_commitment_signature(funding, logger)
4819
4819
}
4820
4820
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.
4823
4822
#[allow(unused)]
4824
4823
fn clone(&self, holder_signer: <SP::Target as SignerProvider>::EcdsaSigner) -> Self {
4825
4824
Self {
4825
+ // Use provided channel signer
4826
+ holder_signer: ChannelSignerType::Ecdsa(holder_signer),
4827
+
4826
4828
config: self.config,
4827
4829
prev_config: self.prev_config,
4828
4830
inbound_handshake_limits_override: self.inbound_handshake_limits_override,
@@ -4831,12 +4833,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
4831
4833
temporary_channel_id: self.temporary_channel_id,
4832
4834
channel_state: self.channel_state,
4833
4835
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(),
4836
4837
// channel_value_satoshis: self.channel_value_satoshis,
4837
4838
latest_monitor_update_id: self.latest_monitor_update_id,
4838
- // Use provided channel signer
4839
- holder_signer: ChannelSignerType::Ecdsa(holder_signer),
4840
4839
shutdown_scriptpubkey: self.shutdown_scriptpubkey.clone(),
4841
4840
destination_script: self.destination_script.clone(),
4842
4841
// holder_commitment_point: self.holder_commitment_point,
@@ -4867,9 +4866,9 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
4867
4866
update_time_counter: self.update_time_counter,
4868
4867
// Create new mutex with copied values
4869
4868
// #[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( ),
4871
4870
// #[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( ),
4873
4872
last_sent_closing_fee: self.last_sent_closing_fee.clone(),
4874
4873
last_received_closing_sig: self.last_received_closing_sig,
4875
4874
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 {
4906
4905
announcement_sigs: self.announcement_sigs,
4907
4906
// Create new mutex with copied values
4908
4907
// #[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(),
4910
4909
// #[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(),
4912
4911
workaround_lnd_bug_4006: self.workaround_lnd_bug_4006.clone(),
4913
4912
sent_message_awaiting_response: self.sent_message_awaiting_response,
4914
4913
channel_type: self.channel_type.clone(),
0 commit comments