@@ -4316,33 +4316,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
43164316 }
43174317 }
43184318
4319- /// Check that a balance value meets the channel reserve requirements or violates them (below reserve).
4320- /// The channel value is an input as opposed to using from self, so that this can be used in case of splicing
4321- /// to checks with new channel value (before being comitted to it).
4322- #[cfg(splicing)]
4323- pub fn check_balance_meets_v2_reserve_requirements(&self, balance: u64, channel_value: u64) -> Result<(), ChannelError> {
4324- if balance == 0 {
4325- return Ok(());
4326- }
4327- let holder_selected_channel_reserve_satoshis = get_v2_channel_reserve_satoshis(
4328- channel_value, self.holder_dust_limit_satoshis);
4329- if balance < holder_selected_channel_reserve_satoshis {
4330- return Err(ChannelError::Warn(format!(
4331- "Balance below reserve mandated by holder, {} vs {}",
4332- balance, holder_selected_channel_reserve_satoshis,
4333- )));
4334- }
4335- let counterparty_selected_channel_reserve_satoshis = get_v2_channel_reserve_satoshis(
4336- channel_value, self.counterparty_dust_limit_satoshis);
4337- if balance < counterparty_selected_channel_reserve_satoshis {
4338- return Err(ChannelError::Warn(format!(
4339- "Balance below reserve mandated by counterparty, {} vs {}",
4340- balance, counterparty_selected_channel_reserve_satoshis,
4341- )));
4342- }
4343- Ok(())
4344- }
4345-
43464319 /// Get the commitment tx fee for the local's (i.e. our) next commitment transaction based on the
43474320 /// number of pending HTLCs that are on track to be in our next commitment tx.
43484321 ///
@@ -8629,11 +8602,9 @@ impl<SP: Deref> FundedChannel<SP> where
86298602 // it can't go below reserve, therefore no pre-check is done here.
86308603
86318604 let pre_channel_value = self.funding.value_to_self_msat;
8632- let post_channel_value = PendingSplice::compute_post_value(pre_channel_value, their_funding_contribution_satoshis, our_funding_contribution_satoshis);
8633- let post_balance = PendingSplice::add_checked(self.funding.value_to_self_msat, our_funding_contribution_satoshis);
8634- // Early check for reserve requirement, assuming maximum balance of full channel value
8635- // This will also be checked later at tx_complete
8636- let _res = self.context.check_balance_meets_v2_reserve_requirements(post_balance, post_channel_value)?;
8605+ let _post_channel_value = PendingSplice::compute_post_value(pre_channel_value, their_funding_contribution_satoshis, our_funding_contribution_satoshis);
8606+ let _post_balance = PendingSplice::add_checked(self.funding.value_to_self_msat, our_funding_contribution_satoshis);
8607+ // TODO: Early check for reserve requirement
86378608
86388609 // TODO(splicing): Store msg.funding_pubkey
86398610 // TODO(splicing): Apply start of splice (splice_start)
@@ -8663,16 +8634,13 @@ impl<SP: Deref> FundedChannel<SP> where
86638634 // TODO(splicing): Pre-check for reserve requirement
86648635 // (Note: It should also be checked later at tx_complete)
86658636
8666-
86678637 let our_funding_contribution = pending_splice.our_funding_contribution;
86688638 let their_funding_contribution_satoshis = msg.funding_contribution_satoshis;
86698639
86708640 let pre_channel_value = self.funding.get_value_satoshis();
8671- let post_channel_value = PendingSplice::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution_satoshis);
8672- let post_balance = PendingSplice::add_checked(self.funding.value_to_self_msat, our_funding_contribution);
8673- // Early check for reserve requirement, assuming maximum balance of full channel value
8674- // This will also be checked later at tx_complete
8675- let _res = self.context.check_balance_meets_v2_reserve_requirements(post_balance, post_channel_value)?;
8641+ let _post_channel_value = PendingSplice::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution_satoshis);
8642+ let _post_balance = PendingSplice::add_checked(self.funding.value_to_self_msat, our_funding_contribution);
8643+ // TODO: Early check for reserve requirement
86768644 Ok(())
86778645 }
86788646
0 commit comments