Remove useless local commitment txn signatures
authorAntoine Riard <ariard@student.42.fr>
Fri, 20 Mar 2020 20:58:13 +0000 (16:58 -0400)
committerAntoine Riard <ariard@student.42.fr>
Sat, 21 Mar 2020 21:03:54 +0000 (17:03 -0400)
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.

lightning/src/ln/channelmonitor.rs

index 717c140956d8abc611649f91e3be3dc3aa4ab91c..2ac113b9845eef43391f5758ebad8335f82af453 100644 (file)
@@ -1749,25 +1749,14 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
                // HTLCs set may differ between last and previous local commitment txn, in case of one them hitting chain, ensure we cancel all HTLCs backward
                let mut is_local_tx = false;
 
-               if let &mut Some(ref mut local_tx) = &mut self.current_local_signed_commitment_tx {
-                       if local_tx.txid == commitment_txid {
-                               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);
-                       }
-               }
                if let &Some(ref local_tx) = &self.current_local_signed_commitment_tx {
                        if local_tx.txid == commitment_txid {
                                is_local_tx = true;
                                log_trace!(self, "Got latest local commitment tx broadcast, searching for available HTLCs to claim");
-                               assert!(local_tx.tx.has_local_sig());
                                let mut res = self.broadcast_by_local_state(local_tx);
                                append_onchain_update!(res);
                        }
                }
-               if let &mut Some(ref mut local_tx) = &mut self.prev_local_signed_commitment_tx {
-                       if local_tx.txid == commitment_txid {
-                               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);
-                       }
-               }
                if let &Some(ref local_tx) = &self.prev_local_signed_commitment_tx {
                        if local_tx.txid == commitment_txid {
                                is_local_tx = true;