@@ -2268,20 +2268,6 @@ impl<SP: Deref> Channel<SP> where
22682268 feerate_per_kw: u32, cur_feerate_per_kw: Option<u32>, logger: &L
22692269 ) -> Result<(), ChannelError> where F::Target: FeeEstimator, L::Target: Logger,
22702270 {
2271- // We only bound the fee updates on the upper side to prevent completely absurd feerates,
2272- // always accepting up to 25 sat/vByte or 10x our fee estimator's "High Priority" fee.
2273- // We generally don't care too much if they set the feerate to something very high, but it
2274- // could result in the channel being useless due to everything being dust. This doesn't
2275- // apply to channels supporting anchor outputs since HTLC transactions are pre-signed with a
2276- // zero fee, so their fee is no longer considered to determine dust limits.
2277- if !channel_type.supports_anchors_zero_fee_htlc_tx() {
2278- let upper_limit =
2279- fee_estimator.bounded_sat_per_1000_weight(ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee) as u64;
2280- if feerate_per_kw as u64 > upper_limit {
2281- return Err(ChannelError::Close(format!("Peer's feerate much too high. Actual: {}. Our expected upper limit: {}", feerate_per_kw, upper_limit)));
2282- }
2283- }
2284-
22852271 let lower_limit_conf_target = if channel_type.supports_anchors_zero_fee_htlc_tx() {
22862272 ConfirmationTarget::MinAllowedAnchorChannelRemoteFee
22872273 } else {
@@ -3986,14 +3972,11 @@ impl<SP: Deref> Channel<SP> where
39863972 return Err(ChannelError::Close("Peer sent update_fee when we needed a channel_reestablish".to_owned()));
39873973 }
39883974 Channel::<SP>::check_remote_fee(&self.context.channel_type, fee_estimator, msg.feerate_per_kw, Some(self.context.feerate_per_kw), logger)?;
3989- let feerate_over_dust_buffer = msg.feerate_per_kw > self.context.get_dust_buffer_feerate(None);
39903975
39913976 self.context.pending_update_fee = Some((msg.feerate_per_kw, FeeUpdateState::RemoteAnnounced));
39923977 self.context.update_time_counter += 1;
3993- // If the feerate has increased over the previous dust buffer (note that
3994- // `get_dust_buffer_feerate` considers the `pending_update_fee` status), check that we
3995- // won't be pushed over our dust exposure limit by the feerate increase.
3996- if feerate_over_dust_buffer {
3978+ // Check that we won't be pushed over our dust exposure limit by the feerate increase.
3979+ if !self.context.channel_type.supports_anchors_zero_fee_htlc_tx() {
39973980 let inbound_stats = self.context.get_inbound_pending_htlc_stats(None);
39983981 let outbound_stats = self.context.get_outbound_pending_htlc_stats(None);
39993982 let holder_tx_dust_exposure = inbound_stats.on_holder_tx_dust_exposure_msat + outbound_stats.on_holder_tx_dust_exposure_msat;
@@ -7816,7 +7799,7 @@ mod tests {
78167799 use crate::ln::PaymentHash;
78177800 use crate::ln::channelmanager::{self, HTLCSource, PaymentId};
78187801 use crate::ln::channel::InitFeatures;
7819- use crate::ln::channel::{Channel, ChannelState, InboundHTLCOutput, OutboundV1Channel, InboundV1Channel, OutboundHTLCOutput, InboundHTLCState, OutboundHTLCState, HTLCCandidate, HTLCInitiator, commit_tx_fee_msat};
7802+ use crate::ln::channel::{ChannelState, InboundHTLCOutput, OutboundV1Channel, InboundV1Channel, OutboundHTLCOutput, InboundHTLCState, OutboundHTLCState, HTLCCandidate, HTLCInitiator, commit_tx_fee_msat};
78207803 use crate::ln::channel::{MAX_FUNDING_SATOSHIS_NO_WUMBO, TOTAL_BITCOIN_SUPPLY_SATOSHIS, MIN_THEIR_CHAN_RESERVE_SATOSHIS};
78217804 use crate::ln::features::ChannelTypeFeatures;
78227805 use crate::ln::msgs::{ChannelUpdate, DecodeError, UnsignedChannelUpdate, MAX_VALUE_MSAT};
@@ -7858,17 +7841,6 @@ mod tests {
78587841 "MAX_FUNDING_SATOSHIS_NO_WUMBO is greater than all satoshis in existence");
78597842 }
78607843
7861- #[test]
7862- fn test_no_fee_check_overflow() {
7863- // Previously, calling `check_remote_fee` with a fee of 0xffffffff would overflow in
7864- // arithmetic, causing a panic with debug assertions enabled.
7865- let fee_est = TestFeeEstimator { fee_est: 42 };
7866- let bounded_fee_estimator = LowerBoundedFeeEstimator::new(&fee_est);
7867- assert!(Channel::<&TestKeysInterface>::check_remote_fee(
7868- &ChannelTypeFeatures::only_static_remote_key(), &bounded_fee_estimator,
7869- u32::max_value(), None, &&test_utils::TestLogger::new()).is_err());
7870- }
7871-
78727844 struct Keys {
78737845 signer: InMemorySigner,
78747846 }
0 commit comments