@@ -2268,20 +2268,6 @@ impl<SP: Deref> Channel<SP> where
2268
2268
feerate_per_kw: u32, cur_feerate_per_kw: Option<u32>, logger: &L
2269
2269
) -> Result<(), ChannelError> where F::Target: FeeEstimator, L::Target: Logger,
2270
2270
{
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
-
2285
2271
let lower_limit_conf_target = if channel_type.supports_anchors_zero_fee_htlc_tx() {
2286
2272
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee
2287
2273
} else {
@@ -3986,14 +3972,11 @@ impl<SP: Deref> Channel<SP> where
3986
3972
return Err(ChannelError::Close("Peer sent update_fee when we needed a channel_reestablish".to_owned()));
3987
3973
}
3988
3974
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);
3990
3975
3991
3976
self.context.pending_update_fee = Some((msg.feerate_per_kw, FeeUpdateState::RemoteAnnounced));
3992
3977
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() {
3997
3980
let inbound_stats = self.context.get_inbound_pending_htlc_stats(None);
3998
3981
let outbound_stats = self.context.get_outbound_pending_htlc_stats(None);
3999
3982
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 {
7816
7799
use crate::ln::PaymentHash;
7817
7800
use crate::ln::channelmanager::{self, HTLCSource, PaymentId};
7818
7801
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};
7820
7803
use crate::ln::channel::{MAX_FUNDING_SATOSHIS_NO_WUMBO, TOTAL_BITCOIN_SUPPLY_SATOSHIS, MIN_THEIR_CHAN_RESERVE_SATOSHIS};
7821
7804
use crate::ln::features::ChannelTypeFeatures;
7822
7805
use crate::ln::msgs::{ChannelUpdate, DecodeError, UnsignedChannelUpdate, MAX_VALUE_MSAT};
@@ -7858,17 +7841,6 @@ mod tests {
7858
7841
"MAX_FUNDING_SATOSHIS_NO_WUMBO is greater than all satoshis in existence");
7859
7842
}
7860
7843
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
-
7872
7844
struct Keys {
7873
7845
signer: InMemorySigner,
7874
7846
}
0 commit comments