Skip to content

Commit f5c1bdc

Browse files
committed
Add TxBuilder::build_commitment_stats
1 parent ac8256c commit f5c1bdc

File tree

4 files changed

+310
-191
lines changed

4 files changed

+310
-191
lines changed

lightning/src/ln/chan_utils.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,14 @@ pub(crate) fn commit_tx_fee_sat(feerate_per_kw: u32, num_htlcs: usize, channel_t
222222
/ 1000
223223
}
224224

225-
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 {
226-
let num_htlcs = num_accepted_htlcs + num_offered_htlcs;
227-
let commit_tx_fees_sat = commit_tx_fee_sat(feerate_per_kw, num_htlcs, channel_type_features);
225+
pub(crate) fn htlc_tx_fees_sat(feerate_per_kw: u32, num_accepted_htlcs: usize, num_offered_htlcs: usize, channel_type_features: &ChannelTypeFeatures) -> u64 {
228226
let htlc_tx_fees_sat = if !channel_type_features.supports_anchors_zero_fee_htlc_tx() {
229227
num_accepted_htlcs as u64 * htlc_success_tx_weight(channel_type_features) * feerate_per_kw as u64 / 1000
230228
+ num_offered_htlcs as u64 * htlc_timeout_tx_weight(channel_type_features) * feerate_per_kw as u64 / 1000
231229
} else {
232230
0
233231
};
234-
commit_tx_fees_sat + htlc_tx_fees_sat
232+
htlc_tx_fees_sat
235233
}
236234

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

0 commit comments

Comments
 (0)