@@ -8289,13 +8289,6 @@ impl<SP: Deref> FundedChannel<SP> where
82898289 // TODO(splicing): check for quiescence
82908290
82918291 let pre_channel_value = self.context.get_value_satoshis();
8292- // Sanity check: capacity cannot decrease below 0
8293- if (pre_channel_value as i64).saturating_add(our_funding_contribution_satoshis) < 0 {
8294- return Err(ChannelError::Warn(format!(
8295- "Post-splicing channel value cannot be negative. It was {} + {}",
8296- pre_channel_value, our_funding_contribution_satoshis
8297- )));
8298- }
82998292
83008293 if our_funding_contribution_satoshis < 0 {
83018294 return Err(ChannelError::Warn(format!(
@@ -8304,6 +8297,9 @@ impl<SP: Deref> FundedChannel<SP> where
83048297 )));
83058298 }
83068299
8300+ // TODO(splicing): Once splice-out is supported, check that channel balance does not go below 0
8301+ // (or below channel reserve)
8302+
83078303 // Note: post-splice channel value is not yet known at this point, counterparty contribution is not known
83088304 // (Cannot test for miminum required post-splice channel value)
83098305
@@ -8347,16 +8343,6 @@ impl<SP: Deref> FundedChannel<SP> where
83478343 }
83488344
83498345 let pre_channel_value = self.context.get_value_satoshis();
8350- // Sanity check: capacity cannot decrease below 0
8351- if (pre_channel_value as i64)
8352- .saturating_add(their_funding_contribution_satoshis)
8353- .saturating_add(our_funding_contribution_satoshis) < 0
8354- {
8355- return Err(ChannelError::Warn(format!(
8356- "Post-splicing channel value cannot be negative. It was {} + {} + {}",
8357- pre_channel_value, their_funding_contribution_satoshis, our_funding_contribution_satoshis,
8358- )));
8359- }
83608346
83618347 if their_funding_contribution_satoshis.saturating_add(our_funding_contribution_satoshis) < 0 {
83628348 return Err(ChannelError::Warn(format!(
@@ -8365,8 +8351,11 @@ impl<SP: Deref> FundedChannel<SP> where
83658351 )));
83668352 }
83678353
8354+ // TODO(splicing): Once splice acceptor can contribute, check that inputs are sufficient,
8355+ // similarly to the check in `splice_channel`.
8356+
83688357 // Note on channel reserve requirement pre-check: as the splice acceptor does not contribute,
8369- // it can go below reserve, therefore no pre-check is done here.
8358+ // it can't go below reserve, therefore no pre-check is done here.
83708359 // TODO(splicing): Once splice acceptor can contribute, add reserve pre-check, similar to the one in `splice_ack`.
83718360
83728361 // TODO(splicing): Store msg.funding_pubkey
0 commit comments