Skip to content

Commit 1fd8098

Browse files
committed
Add TxBuilder::build_commitment_stats
1 parent b10d1e8 commit 1fd8098

File tree

4 files changed

+325
-206
lines changed

4 files changed

+325
-206
lines changed

lightning/src/ln/chan_utils.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,14 @@ pub(crate) fn commit_tx_fee_sat(feerate_per_kw: u32, num_htlcs: usize, channel_t
234234
}
235235

236236
#[rustfmt::skip]
237-
pub(crate) fn commit_and_htlc_tx_fees_sat(feerate_per_kw: u32, num_accepted_htlcs: usize, num_offered_htlcs: usize, channel_type_features: &ChannelTypeFeatures) -> u64 {
238-
let num_htlcs = num_accepted_htlcs + num_offered_htlcs;
239-
let commit_tx_fees_sat = commit_tx_fee_sat(feerate_per_kw, num_htlcs, channel_type_features);
237+
pub(crate) fn htlc_tx_fees_sat(feerate_per_kw: u32, num_accepted_htlcs: usize, num_offered_htlcs: usize, channel_type_features: &ChannelTypeFeatures) -> u64 {
240238
let htlc_tx_fees_sat = if !channel_type_features.supports_anchors_zero_fee_htlc_tx() {
241239
num_accepted_htlcs as u64 * htlc_success_tx_weight(channel_type_features) * feerate_per_kw as u64 / 1000
242240
+ num_offered_htlcs as u64 * htlc_timeout_tx_weight(channel_type_features) * feerate_per_kw as u64 / 1000
243241
} else {
244242
0
245243
};
246-
commit_tx_fees_sat + htlc_tx_fees_sat
244+
htlc_tx_fees_sat
247245
}
248246

249247
// Various functions for key derivation and transaction creation for use within channels. Primarily

0 commit comments

Comments
 (0)