@@ -4316,33 +4316,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
4316
4316
}
4317
4317
}
4318
4318
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
-
4346
4319
/// Get the commitment tx fee for the local's (i.e. our) next commitment transaction based on the
4347
4320
/// number of pending HTLCs that are on track to be in our next commitment tx.
4348
4321
///
@@ -8629,11 +8602,9 @@ impl<SP: Deref> FundedChannel<SP> where
8629
8602
// it can't go below reserve, therefore no pre-check is done here.
8630
8603
8631
8604
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
8637
8608
8638
8609
// TODO(splicing): Store msg.funding_pubkey
8639
8610
// TODO(splicing): Apply start of splice (splice_start)
@@ -8663,16 +8634,13 @@ impl<SP: Deref> FundedChannel<SP> where
8663
8634
// TODO(splicing): Pre-check for reserve requirement
8664
8635
// (Note: It should also be checked later at tx_complete)
8665
8636
8666
-
8667
8637
let our_funding_contribution = pending_splice.our_funding_contribution;
8668
8638
let their_funding_contribution_satoshis = msg.funding_contribution_satoshis;
8669
8639
8670
8640
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
8676
8644
Ok(())
8677
8645
}
8678
8646
0 commit comments