Skip to content

Commit c6b2d01

Browse files
committed
s - drop redundant LocalHTLCFailureReason::AmountExceedsCapacity
1 parent d228c55 commit c6b2d01

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

lightning/src/ln/channel.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9141,14 +9141,6 @@ impl<SP: Deref> FundedChannel<SP> where
91419141
"Cannot send HTLC until channel is fully established and we haven't started shutting down".to_owned()));
91429142
}
91439143

9144-
for funding in core::iter::once(&self.funding).chain(self.pending_funding.iter()) {
9145-
let channel_total_msat = funding.get_value_satoshis() * 1000;
9146-
if amount_msat > channel_total_msat {
9147-
return Err((LocalHTLCFailureReason::AmountExceedsCapacity,
9148-
format!("Cannot send amount {}, because it is more than the total value of the channel {}", amount_msat, channel_total_msat)));
9149-
}
9150-
}
9151-
91529144
if amount_msat == 0 {
91539145
return Err((LocalHTLCFailureReason::ZeroAmount, "Cannot send 0-msat HTLC".to_owned()));
91549146
}

lightning/src/ln/onion_utils.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,8 +1590,6 @@ pub enum LocalHTLCFailureReason {
15901590
/// The HTLC was failed back because its expiry height was reached and funds were timed out
15911591
/// on chain.
15921592
OnChainTimeout,
1593-
/// The HTLC was failed because its amount is greater than the capacity of the channel.
1594-
AmountExceedsCapacity,
15951593
/// The HTLC was failed because zero amount HTLCs are not allowed.
15961594
ZeroAmount,
15971595
/// The HTLC was failed because its amount is less than the smallest HTLC that the channel
@@ -1625,7 +1623,6 @@ impl LocalHTLCFailureReason {
16251623
| Self::DustLimitCounterparty
16261624
| Self::FeeSpikeBuffer
16271625
| Self::ChannelNotReady
1628-
| Self::AmountExceedsCapacity
16291626
| Self::ZeroAmount
16301627
| Self::HTLCMinimum
16311628
| Self::HTLCMaximum
@@ -1780,11 +1777,10 @@ impl_writeable_tlv_based_enum!(LocalHTLCFailureReason,
17801777
(71, OutgoingCLTVTooSoon) => {},
17811778
(73, ChannelClosed) => {},
17821779
(75, OnChainTimeout) => {},
1783-
(77, AmountExceedsCapacity) => {},
1784-
(79, ZeroAmount) => {},
1785-
(81, HTLCMinimum) => {},
1786-
(83, HTLCMaximum) => {},
1787-
(85, PeerOffline) => {},
1780+
(77, ZeroAmount) => {},
1781+
(79, HTLCMinimum) => {},
1782+
(81, HTLCMaximum) => {},
1783+
(83, PeerOffline) => {},
17881784
);
17891785

17901786
impl From<&HTLCFailReason> for HTLCHandlingFailureReason {
@@ -1897,7 +1893,6 @@ impl HTLCFailReason {
18971893
| LocalHTLCFailureReason::DustLimitCounterparty
18981894
| LocalHTLCFailureReason::FeeSpikeBuffer
18991895
| LocalHTLCFailureReason::ChannelNotReady
1900-
| LocalHTLCFailureReason::AmountExceedsCapacity
19011896
| LocalHTLCFailureReason::ZeroAmount
19021897
| LocalHTLCFailureReason::HTLCMinimum
19031898
| LocalHTLCFailureReason::HTLCMaximum

0 commit comments

Comments
 (0)