@@ -6737,11 +6737,13 @@ impl<SP: Deref> FundedChannel<SP> where
67376737 panic!("Cannot update fee while peer is disconnected/we're awaiting a monitor update (ChannelManager should have caught this)");
67386738 }
67396739
6740- core::iter::once(&self.funding)
6740+ let can_send_update_fee = core::iter::once(&self.funding)
67416741 .chain(self.pending_funding.iter())
6742- .map(|funding| self.validate_send_update_fee(funding, feerate_per_kw, fee_estimator, logger))
6743- .collect::<Result<(), ()>>()
6744- .ok()?;
6742+ .map(|funding| self.can_send_update_fee(funding, feerate_per_kw, fee_estimator, logger))
6743+ .all(|can_send_update_fee| can_send_update_fee);
6744+ if !can_send_update_fee {
6745+ return None;
6746+ }
67456747
67466748 // Some of the checks of `can_generate_new_commitment` have already been done above, but
67476749 // it's much more brittle to not use it in favor of checking the remaining flags left, as it
@@ -6764,10 +6766,10 @@ impl<SP: Deref> FundedChannel<SP> where
67646766 })
67656767 }
67666768
6767- fn validate_send_update_fee <F: Deref, L: Deref>(
6769+ fn can_send_update_fee <F: Deref, L: Deref>(
67686770 &self, funding: &FundingScope, feerate_per_kw: u32,
67696771 fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
6770- ) -> Result<(), ()>
6772+ ) -> bool
67716773 where
67726774 F::Target: FeeEstimator,
67736775 L::Target: Logger,
@@ -6784,21 +6786,21 @@ impl<SP: Deref> FundedChannel<SP> where
67846786 if holder_balance_msat < buffer_fee_msat + commitment_data.stats.total_anchors_sat * 1000 + funding.counterparty_selected_channel_reserve_satoshis.unwrap() * 1000 {
67856787 //TODO: auto-close after a number of failures?
67866788 log_debug!(logger, "Cannot afford to send new feerate at {}", feerate_per_kw);
6787- return Err(()) ;
6789+ return false ;
67886790 }
67896791
67906792 // Note, we evaluate pending htlc "preemptive" trimmed-to-dust threshold at the proposed `feerate_per_kw`.
67916793 let max_dust_htlc_exposure_msat = self.context.get_max_dust_htlc_exposure_msat(dust_exposure_limiting_feerate);
67926794 if htlc_stats.on_holder_tx_dust_exposure_msat > max_dust_htlc_exposure_msat {
67936795 log_debug!(logger, "Cannot afford to send new feerate at {} without infringing max dust htlc exposure", feerate_per_kw);
6794- return Err(()) ;
6796+ return false ;
67956797 }
67966798 if htlc_stats.on_counterparty_tx_dust_exposure_msat > max_dust_htlc_exposure_msat {
67976799 log_debug!(logger, "Cannot afford to send new feerate at {} without infringing max dust htlc exposure", feerate_per_kw);
6798- return Err(()) ;
6800+ return false ;
67996801 }
68006802
6801- Ok(())
6803+ return true;
68026804 }
68036805
68046806 /// Removes any uncommitted inbound HTLCs and resets the state of uncommitted outbound HTLC
0 commit comments