Skip to content

Commit 502197d

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 82e7887 commit 502197d

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

lightning/src/ln/channelmonitor.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,25 +1749,14 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
17491749
// HTLCs set may differ between last and previous local commitment txn, in case of one them hitting chain, ensure we cancel all HTLCs backward
17501750
let mut is_local_tx = false;
17511751

1752-
if let &mut Some(ref mut local_tx) = &mut self.current_local_signed_commitment_tx {
1753-
if local_tx.txid == commitment_txid {
1754-
local_tx.tx.add_local_sig(&self.onchain_detection.keys.funding_key(), self.funding_redeemscript.as_ref().unwrap(), self.channel_value_satoshis.unwrap(), &self.secp_ctx);
1755-
}
1756-
}
17571752
if let &Some(ref local_tx) = &self.current_local_signed_commitment_tx {
17581753
if local_tx.txid == commitment_txid {
17591754
is_local_tx = true;
17601755
log_trace!(self, "Got latest local commitment tx broadcast, searching for available HTLCs to claim");
1761-
assert!(local_tx.tx.has_local_sig());
17621756
let mut res = self.broadcast_by_local_state(local_tx);
17631757
append_onchain_update!(res);
17641758
}
17651759
}
1766-
if let &mut Some(ref mut local_tx) = &mut self.prev_local_signed_commitment_tx {
1767-
if local_tx.txid == commitment_txid {
1768-
local_tx.tx.add_local_sig(&self.onchain_detection.keys.funding_key(), self.funding_redeemscript.as_ref().unwrap(), self.channel_value_satoshis.unwrap(), &self.secp_ctx);
1769-
}
1770-
}
17711760
if let &Some(ref local_tx) = &self.prev_local_signed_commitment_tx {
17721761
if local_tx.txid == commitment_txid {
17731762
is_local_tx = true;

0 commit comments

Comments
 (0)