@@ -8,7 +8,8 @@ use bitcoin::secp256k1::{self, PublicKey, Secp256k1};
8
8
9
9
use crate :: ln:: chan_utils:: {
10
10
commit_tx_fee_sat, htlc_success_tx_weight, htlc_timeout_tx_weight, htlc_tx_fees_sat,
11
- ChannelTransactionParameters , CommitmentTransaction , HTLCOutputInCommitment ,
11
+ second_stage_tx_fees_sat, ChannelTransactionParameters , CommitmentTransaction ,
12
+ HTLCOutputInCommitment ,
12
13
} ;
13
14
use crate :: ln:: channel:: { CommitmentStats , ANCHOR_OUTPUT_VALUE_SATOSHI } ;
14
15
use crate :: prelude:: * ;
@@ -25,17 +26,10 @@ impl HTLCAmountDirection {
25
26
& self , local : bool , feerate_per_kw : u32 , broadcaster_dust_limit_satoshis : u64 ,
26
27
channel_type : & ChannelTypeFeatures ,
27
28
) -> bool {
28
- let htlc_tx_fee_sat = if channel_type. supports_anchors_zero_fee_htlc_tx ( ) {
29
- 0
30
- } else {
31
- let htlc_tx_weight = if self . outbound == local {
32
- htlc_timeout_tx_weight ( channel_type)
33
- } else {
34
- htlc_success_tx_weight ( channel_type)
35
- } ;
36
- // As required by the spec, round down
37
- feerate_per_kw as u64 * htlc_tx_weight / 1000
38
- } ;
29
+ let ( success_tx_fee_sat, timeout_tx_fee_sat) =
30
+ second_stage_tx_fees_sat ( channel_type, feerate_per_kw) ;
31
+ let htlc_tx_fee_sat =
32
+ if self . outbound == local { timeout_tx_fee_sat } else { success_tx_fee_sat } ;
39
33
self . amount_msat / 1000 < broadcaster_dust_limit_satoshis + htlc_tx_fee_sat
40
34
}
41
35
}
0 commit comments