@@ -2162,20 +2162,6 @@ impl<SP: Deref> Channel<SP> where
2162
2162
feerate_per_kw: u32, cur_feerate_per_kw: Option<u32>, logger: &L
2163
2163
) -> Result<(), ChannelError> where F::Target: FeeEstimator, L::Target: Logger,
2164
2164
{
2165
- // We only bound the fee updates on the upper side to prevent completely absurd feerates,
2166
- // always accepting up to 25 sat/vByte or 10x our fee estimator's "High Priority" fee.
2167
- // We generally don't care too much if they set the feerate to something very high, but it
2168
- // could result in the channel being useless due to everything being dust. This doesn't
2169
- // apply to channels supporting anchor outputs since HTLC transactions are pre-signed with a
2170
- // zero fee, so their fee is no longer considered to determine dust limits.
2171
- if !channel_type.supports_anchors_zero_fee_htlc_tx() {
2172
- let upper_limit =
2173
- fee_estimator.bounded_sat_per_1000_weight(ConfirmationTarget::MaxAllowedNonAnchorChannelRemoteFee) as u64;
2174
- if feerate_per_kw as u64 > upper_limit {
2175
- return Err(ChannelError::Close(format!("Peer's feerate much too high. Actual: {}. Our expected upper limit: {}", feerate_per_kw, upper_limit)));
2176
- }
2177
- }
2178
-
2179
2165
let lower_limit_conf_target = if channel_type.supports_anchors_zero_fee_htlc_tx() {
2180
2166
ConfirmationTarget::MinAllowedAnchorChannelRemoteFee
2181
2167
} else {
@@ -3872,14 +3858,11 @@ impl<SP: Deref> Channel<SP> where
3872
3858
return Err(ChannelError::Close("Peer sent update_fee when we needed a channel_reestablish".to_owned()));
3873
3859
}
3874
3860
Channel::<SP>::check_remote_fee(&self.context.channel_type, fee_estimator, msg.feerate_per_kw, Some(self.context.feerate_per_kw), logger)?;
3875
- let feerate_over_dust_buffer = msg.feerate_per_kw > self.context.get_dust_buffer_feerate(None);
3876
3861
3877
3862
self.context.pending_update_fee = Some((msg.feerate_per_kw, FeeUpdateState::RemoteAnnounced));
3878
3863
self.context.update_time_counter += 1;
3879
- // If the feerate has increased over the previous dust buffer (note that
3880
- // `get_dust_buffer_feerate` considers the `pending_update_fee` status), check that we
3881
- // won't be pushed over our dust exposure limit by the feerate increase.
3882
- if feerate_over_dust_buffer {
3864
+ // Check that we won't be pushed over our dust exposure limit by the feerate increase.
3865
+ if !self.context.channel_type.supports_anchors_zero_fee_htlc_tx() {
3883
3866
let inbound_stats = self.context.get_inbound_pending_htlc_stats(None);
3884
3867
let outbound_stats = self.context.get_outbound_pending_htlc_stats(None);
3885
3868
let holder_tx_dust_exposure = inbound_stats.on_holder_tx_dust_exposure_msat + outbound_stats.on_holder_tx_dust_exposure_msat;
@@ -7684,7 +7667,7 @@ mod tests {
7684
7667
use crate::ln::PaymentHash;
7685
7668
use crate::ln::channelmanager::{self, HTLCSource, PaymentId};
7686
7669
use crate::ln::channel::InitFeatures;
7687
- use crate::ln::channel::{Channel, ChannelState, InboundHTLCOutput, OutboundV1Channel, InboundV1Channel, OutboundHTLCOutput, InboundHTLCState, OutboundHTLCState, HTLCCandidate, HTLCInitiator, commit_tx_fee_msat};
7670
+ use crate::ln::channel::{ChannelState, InboundHTLCOutput, OutboundV1Channel, InboundV1Channel, OutboundHTLCOutput, InboundHTLCState, OutboundHTLCState, HTLCCandidate, HTLCInitiator, commit_tx_fee_msat};
7688
7671
use crate::ln::channel::{MAX_FUNDING_SATOSHIS_NO_WUMBO, TOTAL_BITCOIN_SUPPLY_SATOSHIS, MIN_THEIR_CHAN_RESERVE_SATOSHIS};
7689
7672
use crate::ln::features::ChannelTypeFeatures;
7690
7673
use crate::ln::msgs::{ChannelUpdate, DecodeError, UnsignedChannelUpdate, MAX_VALUE_MSAT};
@@ -7726,17 +7709,6 @@ mod tests {
7726
7709
"MAX_FUNDING_SATOSHIS_NO_WUMBO is greater than all satoshis in existence");
7727
7710
}
7728
7711
7729
- #[test]
7730
- fn test_no_fee_check_overflow() {
7731
- // Previously, calling `check_remote_fee` with a fee of 0xffffffff would overflow in
7732
- // arithmetic, causing a panic with debug assertions enabled.
7733
- let fee_est = TestFeeEstimator { fee_est: 42 };
7734
- let bounded_fee_estimator = LowerBoundedFeeEstimator::new(&fee_est);
7735
- assert!(Channel::<&TestKeysInterface>::check_remote_fee(
7736
- &ChannelTypeFeatures::only_static_remote_key(), &bounded_fee_estimator,
7737
- u32::max_value(), None, &&test_utils::TestLogger::new()).is_err());
7738
- }
7739
-
7740
7712
struct Keys {
7741
7713
signer: InMemorySigner,
7742
7714
}
0 commit comments