Skip to content

Commit c73b56c

Browse files
committed
Comments; reg. reserve check; review
1 parent f05016e commit c73b56c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lightning/src/ln/channel.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8402,7 +8402,8 @@ impl<SP: Deref> FundedChannel<SP> where
84028402
// Note: post-splice channel value is not yet known at this point, counterparty contribution is not known
84038403
// (Cannot test for miminum required post-splice channel value)
84048404

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.
84068407
let sum_input: i64 = our_funding_inputs.into_iter().map(
84078408
|(txin, tx)| tx.output.get(txin.previous_output.vout as usize).map(|tx| tx.value.to_sat() as i64).unwrap_or(0)
84088409
).sum();
@@ -8459,11 +8460,9 @@ impl<SP: Deref> FundedChannel<SP> where
84598460
)));
84608461
}
84618462

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`.
84678466

84688467
// TODO(splicing): Store msg.funding_pubkey
84698468
// TODO(splicing): Apply start of splice (splice_start)
@@ -8490,7 +8489,7 @@ impl<SP: Deref> FundedChannel<SP> where
84908489
let pre_channel_value = self.funding.get_value_satoshis();
84918490
let post_channel_value = PendingSplice::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution_satoshis);
84928491
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
84948493
// This will also be checked later at tx_complete
84958494
let _res = self.context.check_balance_meets_v2_reserve_requirements(post_balance, post_channel_value)?;
84968495
Ok(())

0 commit comments

Comments
 (0)