Cache local_commitment_tx in OnchainTxHandler
[rust-lightning] / lightning / src / ln / channelmonitor.rs
index 6855ac15a77e9ad163921995169ea4e903f2dd09..70c92143af8b50d58eb06f9c10878fc6fe190e2d 100644 (file)
@@ -1244,7 +1244,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
                self.prev_local_signed_commitment_tx = self.current_local_signed_commitment_tx.take();
                self.current_local_signed_commitment_tx = Some(LocalSignedTx {
                        txid: commitment_tx.txid(),
-                       tx: commitment_tx,
+                       tx: commitment_tx.clone(),
                        revocation_key: local_keys.revocation_key,
                        a_htlc_key: local_keys.a_htlc_key,
                        b_htlc_key: local_keys.b_htlc_key,
@@ -1253,6 +1253,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
                        feerate_per_kw,
                        htlc_outputs,
                });
+               self.onchain_tx_handler.provide_latest_local_tx(commitment_tx);
                Ok(())
        }