File tree 1 file changed +3
-4
lines changed
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -2954,17 +2954,16 @@ impl<Signer: Sign> Channel<Signer> {
2954
2954
}
2955
2955
2956
2956
// Before to propose a feerate update, check that we can actually afford the new fee compare to the holder balance.
2957
- let num_htlcs = self . pending_inbound_htlcs . len ( ) + self . pending_outbound_htlcs . len ( ) ;
2958
- let total_fee = feerate_per_kw as u64 * ( COMMITMENT_TX_BASE_WEIGHT + ( num_htlcs as u64 ) * COMMITMENT_TX_WEIGHT_PER_HTLC ) / 1000 ;
2957
+ let inbound_stats = self . get_inbound_pending_htlc_stats ( Some ( feerate_per_kw) ) ;
2958
+ let outbound_stats = self . get_outbound_pending_htlc_stats ( Some ( feerate_per_kw) ) ;
2959
+ let total_fee = feerate_per_kw as u64 * ( COMMITMENT_TX_BASE_WEIGHT + ( inbound_stats. pending_htlcs as u64 + outbound_stats. pending_htlcs as u64 ) * COMMITMENT_TX_WEIGHT_PER_HTLC ) / 1000 ;
2959
2960
if self . value_to_self_msat / 1000 - total_fee < self . counterparty_selected_channel_reserve_satoshis . unwrap ( ) {
2960
2961
log_debug ! ( logger, "Cannot afford to send new feerate at {}" , feerate_per_kw) ;
2961
2962
return None ;
2962
2963
}
2963
2964
2964
2965
if feerate_per_kw > self . get_dust_buffer_feerate ( None ) {
2965
2966
// Note, we evaluate pending htlc "preemptive" trimmed-to-dust threshold at the proposed `feerate_per_kw`.
2966
- let inbound_stats = self . get_inbound_pending_htlc_stats ( Some ( feerate_per_kw) ) ;
2967
- let outbound_stats = self . get_outbound_pending_htlc_stats ( Some ( feerate_per_kw) ) ;
2968
2967
let holder_tx_dust_exposure = inbound_stats. on_holder_tx_dust_exposure_msat + outbound_stats. on_holder_tx_dust_exposure_msat ;
2969
2968
let counterparty_tx_dust_exposure = inbound_stats. on_counterparty_tx_dust_exposure_msat + outbound_stats. on_counterparty_tx_dust_exposure_msat ;
2970
2969
if holder_tx_dust_exposure > self . get_max_dust_htlc_exposure_msat ( ) {
You can’t perform that action at this time.
0 commit comments