You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lightning/src/ln/channel.rs
+11-4Lines changed: 11 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -2780,6 +2780,13 @@ impl<SP: Deref> Channel<SP> where
2780
2780
if inbound_stats.pending_htlcs_value_msat + msg.amount_msat > self.context.holder_max_htlc_value_in_flight_msat {
2781
2781
return Err(ChannelError::Close(format!("Remote HTLC add would put them over our max HTLC value ({})", self.context.holder_max_htlc_value_in_flight_msat)));
2782
2782
}
2783
+
2784
+
let anchor_outputs_value_msat = if self.context.get_channel_type().supports_anchors_zero_fee_htlc_tx() {
2785
+
ANCHOR_OUTPUT_VALUE_SATOSHI * 2 * 1000
2786
+
} else {
2787
+
0
2788
+
};
2789
+
2783
2790
// Check holder_selected_channel_reserve_satoshis (we're getting paid, so they have to at least meet
2784
2791
// the reserve_satoshis we told them to always have as direct payment so that they lose
2785
2792
// something if we punish them for broadcasting an old state).
@@ -2843,11 +2850,11 @@ impl<SP: Deref> Channel<SP> where
2843
2850
let htlc_candidate = HTLCCandidate::new(msg.amount_msat, HTLCInitiator::RemoteOffered);
2844
2851
self.context.next_remote_commit_tx_fee_msat(htlc_candidate, None) // Don't include the extra fee spike buffer HTLC in calculations
2845
2852
};
2846
-
if pending_remote_value_msat - msg.amount_msat < remote_commit_tx_fee_msat {
2853
+
if pending_remote_value_msat - msg.amount_msat - anchor_outputs_value_msat < remote_commit_tx_fee_msat {
2847
2854
return Err(ChannelError::Close("Remote HTLC add would not leave enough to pay for fees".to_owned()));
0 commit comments