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
// Note that we need to divide before multiplying to round properly,
2130
2130
// since the lowest denomination of bitcoin on-chain is the satoshi.
2131
2131
(commitment_tx_base_weight(channel_type_features) + num_htlcs as u64 * COMMITMENT_TX_WEIGHT_PER_HTLC) * feerate_per_kw as u64 / 1000 * 1000
@@ -2772,6 +2772,7 @@ impl<SP: Deref> Channel<SP> where
2772
2772
if inbound_stats.pending_htlcs_value_msat + msg.amount_msat > self.context.holder_max_htlc_value_in_flight_msat {
2773
2773
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)));
2774
2774
}
2775
+
2775
2776
// Check holder_selected_channel_reserve_satoshis (we're getting paid, so they have to at least meet
2776
2777
// the reserve_satoshis we told them to always have as direct payment so that they lose
2777
2778
// something if we punish them for broadcasting an old state).
@@ -2831,18 +2832,29 @@ impl<SP: Deref> Channel<SP> where
2831
2832
2832
2833
// Check that the remote can afford to pay for this HTLC on-chain at the current
2833
2834
// feerate_per_kw, while maintaining their channel reserve (as required by the spec).
2834
-
let remote_commit_tx_fee_msat = if self.context.is_outbound() { 0 } else {
2835
-
let htlc_candidate = HTLCCandidate::new(msg.amount_msat, HTLCInitiator::RemoteOffered);
2836
-
self.context.next_remote_commit_tx_fee_msat(htlc_candidate, None) // Don't include the extra fee spike buffer HTLC in calculations
2837
-
};
2838
-
if pending_remote_value_msat - msg.amount_msat < remote_commit_tx_fee_msat {
2839
-
return Err(ChannelError::Close("Remote HTLC add would not leave enough to pay for fees".to_owned()));
0 commit comments