Skip to content

Commit 09fae43

Browse files
author
Antoine Riard
committed
Remove useless local commitment txn signatures
check_spend_local_transaction is tasked with detection of onchain local commitment transaction and generate HTLC transaction. Signing an already onchain tx isn't necessary.
1 parent 287c0f2 commit 09fae43

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

lightning/src/ln/channelmonitor.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,30 +1769,18 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
17691769
// HTLCs set may differ between last and previous local commitment txn, in case of one them hitting chain, ensure we cancel all HTLCs backward
17701770
let mut is_local_tx = false;
17711771

1772-
if let &mut Some(ref mut local_tx) = &mut self.current_local_signed_commitment_tx {
1773-
if local_tx.txid == commitment_txid {
1774-
local_tx.tx.add_local_sig(&self.onchain_detection.funding_key, self.funding_redeemscript.as_ref().unwrap(), self.channel_value_satoshis.unwrap(), &self.secp_ctx);
1775-
}
1776-
}
17771772
if let &Some(ref local_tx) = &self.current_local_signed_commitment_tx {
17781773
if local_tx.txid == commitment_txid {
17791774
is_local_tx = true;
17801775
log_trace!(self, "Got latest local commitment tx broadcast, searching for available HTLCs to claim");
1781-
assert!(local_tx.tx.has_local_sig());
17821776
let mut res = self.broadcast_by_local_state(local_tx, &self.onchain_detection.delayed_payment_base_key);
17831777
append_onchain_update!(res);
17841778
}
17851779
}
1786-
if let &mut Some(ref mut local_tx) = &mut self.prev_local_signed_commitment_tx {
1787-
if local_tx.txid == commitment_txid {
1788-
local_tx.tx.add_local_sig(&self.onchain_detection.funding_key, self.funding_redeemscript.as_ref().unwrap(), self.channel_value_satoshis.unwrap(), &self.secp_ctx);
1789-
}
1790-
}
17911780
if let &Some(ref local_tx) = &self.prev_local_signed_commitment_tx {
17921781
if local_tx.txid == commitment_txid {
17931782
is_local_tx = true;
17941783
log_trace!(self, "Got previous local commitment tx broadcast, searching for available HTLCs to claim");
1795-
assert!(local_tx.tx.has_local_sig());
17961784
let mut res = self.broadcast_by_local_state(local_tx, &self.onchain_detection.delayed_payment_base_key);
17971785
append_onchain_update!(res);
17981786
}

0 commit comments

Comments
 (0)