+ let num_htlcs = included_htlcs + addl_htlcs;
+ let res = self.commit_tx_fee_msat(num_htlcs);
+ #[cfg(any(test, feature = "fuzztarget"))]
+ {
+ let mut fee = res;
+ if fee_spike_buffer_htlc.is_some() {
+ fee = self.commit_tx_fee_msat(num_htlcs - 1);
+ }
+ let total_pending_htlcs = self.pending_inbound_htlcs.len() + self.pending_outbound_htlcs.len()
+ + self.holding_cell_htlc_updates.len();
+ let commitment_tx_info = CommitmentTxInfoCached {
+ fee,
+ total_pending_htlcs,
+ next_holder_htlc_id: match htlc.origin {
+ HTLCInitiator::LocalOffered => self.next_holder_htlc_id + 1,
+ HTLCInitiator::RemoteOffered => self.next_holder_htlc_id,
+ },
+ next_counterparty_htlc_id: match htlc.origin {
+ HTLCInitiator::LocalOffered => self.next_counterparty_htlc_id,
+ HTLCInitiator::RemoteOffered => self.next_counterparty_htlc_id + 1,
+ },
+ feerate: self.feerate_per_kw,
+ };
+ *self.next_local_commitment_tx_fee_info_cached.lock().unwrap() = Some(commitment_tx_info);
+ }
+ res