@@ -6738,11 +6738,13 @@ impl<SP: Deref> FundedChannel<SP> where
6738
6738
panic!("Cannot update fee while peer is disconnected/we're awaiting a monitor update (ChannelManager should have caught this)");
6739
6739
}
6740
6740
6741
- core::iter::once(&self.funding)
6741
+ let can_send_update_fee = core::iter::once(&self.funding)
6742
6742
.chain(self.pending_funding.iter())
6743
- .map(|funding| self.validate_send_update_fee(funding, feerate_per_kw, fee_estimator, logger))
6744
- .collect::<Result<(), ()>>()
6745
- .ok()?;
6743
+ .map(|funding| self.can_send_update_fee(funding, feerate_per_kw, fee_estimator, logger))
6744
+ .all(|can_send_update_fee| can_send_update_fee);
6745
+ if !can_send_update_fee {
6746
+ return None;
6747
+ }
6746
6748
6747
6749
// Some of the checks of `can_generate_new_commitment` have already been done above, but
6748
6750
// it's much more brittle to not use it in favor of checking the remaining flags left, as it
@@ -6765,10 +6767,10 @@ impl<SP: Deref> FundedChannel<SP> where
6765
6767
})
6766
6768
}
6767
6769
6768
- fn validate_send_update_fee <F: Deref, L: Deref>(
6770
+ fn can_send_update_fee <F: Deref, L: Deref>(
6769
6771
&self, funding: &FundingScope, feerate_per_kw: u32,
6770
6772
fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
6771
- ) -> Result<(), ()>
6773
+ ) -> bool
6772
6774
where
6773
6775
F::Target: FeeEstimator,
6774
6776
L::Target: Logger,
@@ -6785,21 +6787,21 @@ impl<SP: Deref> FundedChannel<SP> where
6785
6787
if holder_balance_msat < buffer_fee_msat + commitment_data.stats.total_anchors_sat * 1000 + funding.counterparty_selected_channel_reserve_satoshis.unwrap() * 1000 {
6786
6788
//TODO: auto-close after a number of failures?
6787
6789
log_debug!(logger, "Cannot afford to send new feerate at {}", feerate_per_kw);
6788
- return Err(()) ;
6790
+ return false ;
6789
6791
}
6790
6792
6791
6793
// Note, we evaluate pending htlc "preemptive" trimmed-to-dust threshold at the proposed `feerate_per_kw`.
6792
6794
let max_dust_htlc_exposure_msat = self.context.get_max_dust_htlc_exposure_msat(dust_exposure_limiting_feerate);
6793
6795
if htlc_stats.on_holder_tx_dust_exposure_msat > max_dust_htlc_exposure_msat {
6794
6796
log_debug!(logger, "Cannot afford to send new feerate at {} without infringing max dust htlc exposure", feerate_per_kw);
6795
- return Err(()) ;
6797
+ return false ;
6796
6798
}
6797
6799
if htlc_stats.on_counterparty_tx_dust_exposure_msat > max_dust_htlc_exposure_msat {
6798
6800
log_debug!(logger, "Cannot afford to send new feerate at {} without infringing max dust htlc exposure", feerate_per_kw);
6799
- return Err(()) ;
6801
+ return false ;
6800
6802
}
6801
6803
6802
- Ok(())
6804
+ return true;
6803
6805
}
6804
6806
6805
6807
/// Removes any uncommitted inbound HTLCs and resets the state of uncommitted outbound HTLC
0 commit comments