@@ -8402,7 +8402,8 @@ impl<SP: Deref> FundedChannel<SP> where
8402
8402
// Note: post-splice channel value is not yet known at this point, counterparty contribution is not known
8403
8403
// (Cannot test for miminum required post-splice channel value)
8404
8404
8405
- // Check that inputs are sufficient to cover our contribution
8405
+ // Pre-check that inputs are sufficient to cover our contribution.
8406
+ // Note: fees are not taken into account here.
8406
8407
let sum_input: i64 = our_funding_inputs.into_iter().map(
8407
8408
|(txin, tx)| tx.output.get(txin.previous_output.vout as usize).map(|tx| tx.value.to_sat() as i64).unwrap_or(0)
8408
8409
).sum();
@@ -8459,11 +8460,9 @@ impl<SP: Deref> FundedChannel<SP> where
8459
8460
)));
8460
8461
}
8461
8462
8462
- let post_channel_value = PendingSplice::compute_post_value(pre_channel_value, their_funding_contribution_satoshis, our_funding_contribution_satoshis);
8463
- let post_balance = PendingSplice::add_checked(self.funding.value_to_self_msat, our_funding_contribution_satoshis);
8464
- // Early check for reserve requirement, assuming maximum balance of full channel value
8465
- // This will also be checked later at tx_complete
8466
- let _res = self.context.check_balance_meets_v2_reserve_requirements(post_balance, post_channel_value)?;
8463
+ // Note on channel reserve requirement pre-check: as the splice acceptor does not contribute,
8464
+ // it can go below reserve, therefore no pre-check is done here.
8465
+ // TODO(splicing): Once splice acceptor can contribute, add reserve pre-check, similar to the one in `splice_ack`.
8467
8466
8468
8467
// TODO(splicing): Store msg.funding_pubkey
8469
8468
// TODO(splicing): Apply start of splice (splice_start)
@@ -8490,7 +8489,7 @@ impl<SP: Deref> FundedChannel<SP> where
8490
8489
let pre_channel_value = self.funding.get_value_satoshis();
8491
8490
let post_channel_value = PendingSplice::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution_satoshis);
8492
8491
let post_balance = PendingSplice::add_checked(self.funding.value_to_self_msat, our_funding_contribution);
8493
- // Early check for reserve requirement, assuming maximum balance of full channel value
8492
+ // Pre- check for reserve requirement, assuming maximum balance of full channel value
8494
8493
// This will also be checked later at tx_complete
8495
8494
let _res = self.context.check_balance_meets_v2_reserve_requirements(post_balance, post_channel_value)?;
8496
8495
Ok(())
0 commit comments