@@ -8864,20 +8864,27 @@ impl<SP: Deref> FundedChannel<SP> where
88648864 for funding in core::iter::once(&self.funding).chain(self.pending_funding.iter()) {
88658865 let (mut htlcs_ref, counterparty_commitment_tx) =
88668866 self.build_commitment_no_state_update(funding, logger);
8867- let counterparty_commitment_txid = counterparty_commitment_tx.trust().txid();
8868- let htlcs: Vec<(HTLCOutputInCommitment, Option<Box<HTLCSource>>)> =
8867+ let htlc_outputs: Vec<(HTLCOutputInCommitment, Option<Box<HTLCSource>>)> =
88698868 htlcs_ref.drain(..).map(|(htlc, htlc_source)| (htlc, htlc_source.map(|source_ref| Box::new(source_ref.clone())))).collect();
8870- // Soon, we will switch this to `LatestCounterpartyCommitmentTX`,
8871- // and provide the full commit tx instead of the information needed to rebuild it.
8872- updates.push(ChannelMonitorUpdateStep::LatestCounterpartyCommitmentTXInfo {
8873- commitment_txid: counterparty_commitment_txid,
8874- htlc_outputs: htlcs.clone(),
8875- commitment_number: self.context.cur_counterparty_commitment_transaction_number,
8876- their_per_commitment_point: self.context.counterparty_cur_commitment_point.unwrap(),
8877- feerate_per_kw: Some(counterparty_commitment_tx.feerate_per_kw()),
8878- to_broadcaster_value_sat: Some(counterparty_commitment_tx.to_broadcaster_value_sat()),
8879- to_countersignatory_value_sat: Some(counterparty_commitment_tx.to_countersignatory_value_sat()),
8880- });
8869+
8870+ if self.pending_funding.is_empty() {
8871+ // Soon, we will switch this to `LatestCounterpartyCommitmentTX`,
8872+ // and provide the full commit tx instead of the information needed to rebuild it.
8873+ updates.push(ChannelMonitorUpdateStep::LatestCounterpartyCommitmentTXInfo {
8874+ commitment_txid: counterparty_commitment_tx.trust().txid(),
8875+ htlc_outputs,
8876+ commitment_number: self.context.cur_counterparty_commitment_transaction_number,
8877+ their_per_commitment_point: self.context.counterparty_cur_commitment_point.unwrap(),
8878+ feerate_per_kw: Some(counterparty_commitment_tx.feerate_per_kw()),
8879+ to_broadcaster_value_sat: Some(counterparty_commitment_tx.to_broadcaster_value_sat()),
8880+ to_countersignatory_value_sat: Some(counterparty_commitment_tx.to_countersignatory_value_sat()),
8881+ });
8882+ } else {
8883+ updates.push(ChannelMonitorUpdateStep::LatestCounterpartyCommitmentTX {
8884+ htlc_outputs,
8885+ commitment_tx: counterparty_commitment_tx,
8886+ });
8887+ }
88818888 }
88828889
88838890 if self.context.announcement_sigs_state == AnnouncementSigsState::MessageSent {
0 commit comments