@@ -1184,12 +1184,12 @@ impl UnfundedChannelContext {
11841184/// Info about a pending splice, used in the pre-splice channel
11851185#[cfg(splicing)]
11861186#[derive(Clone)]
1187- struct PendingSpliceInfoPre {
1187+ struct PendingSplice {
11881188 pub our_funding_contribution: i64,
11891189}
11901190
11911191#[cfg(splicing)]
1192- impl PendingSpliceInfoPre {
1192+ impl PendingSplice {
11931193 #[inline]
11941194 fn add_checked(base: u64, delta: i64) -> u64 {
11951195 if delta >= 0 {
@@ -4298,7 +4298,7 @@ pub(super) struct Channel<SP: Deref> where SP::Target: SignerProvider {
42984298 pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
42994299 /// Info about an in-progress, pending splice (if any), on the pre-splice channel
43004300 #[cfg(splicing)]
4301- pending_splice_pre: Option<PendingSpliceInfoPre >,
4301+ pending_splice_pre: Option<PendingSplice >,
43024302}
43034303
43044304#[cfg(any(test, fuzzing))]
@@ -7937,17 +7937,17 @@ impl<SP: Deref> Channel<SP> where
79377937 // (Cannot test for miminum required post-splice channel value)
79387938
79397939 // Check that inputs are sufficient to cover our contribution
7940- let sum_input: i64 = our_funding_inputs.into_iter().fold(0, |acc, i|
7941- acc + i.1. output.get(i.0 .previous_output.vout as usize).map(|tx| tx.value.to_sat() as i64).unwrap_or(0)
7942- );
7940+ let sum_input: i64 = our_funding_inputs.into_iter().map(
7941+ |(txin, tx)| tx. output.get(txin .previous_output.vout as usize).map(|tx| tx.value.to_sat() as i64).unwrap_or(0)
7942+ ).sum() ;
79437943 if sum_input < our_funding_contribution_satoshis {
79447944 return Err(ChannelError::Warn(format!(
79457945 "Provided inputs are insufficient for our contribution, {} {}",
79467946 sum_input, our_funding_contribution_satoshis,
79477947 )));
79487948 }
79497949
7950- self.pending_splice_pre = Some(PendingSpliceInfoPre {
7950+ self.pending_splice_pre = Some(PendingSplice {
79517951 our_funding_contribution: our_funding_contribution_satoshis,
79527952 });
79537953
@@ -7993,8 +7993,8 @@ impl<SP: Deref> Channel<SP> where
79937993 )));
79947994 }
79957995
7996- let post_channel_value = PendingSpliceInfoPre ::compute_post_value(pre_channel_value, their_funding_contribution_satoshis, our_funding_contribution_satoshis);
7997- let post_balance = PendingSpliceInfoPre ::add_checked(self.context.value_to_self_msat, our_funding_contribution_satoshis);
7996+ let post_channel_value = PendingSplice ::compute_post_value(pre_channel_value, their_funding_contribution_satoshis, our_funding_contribution_satoshis);
7997+ let post_balance = PendingSplice ::add_checked(self.context.value_to_self_msat, our_funding_contribution_satoshis);
79987998 // Early check for reserve requirement, assuming maximum balance of full channel value
79997999 // This will also be checked later at tx_complete
80008000 let _res = self.context.check_balance_meets_reserve_requirements(post_balance, post_channel_value)?;
@@ -8022,8 +8022,8 @@ impl<SP: Deref> Channel<SP> where
80228022 let our_funding_contribution = pending_splice.our_funding_contribution;
80238023
80248024 let pre_channel_value = self.context.get_value_satoshis();
8025- let post_channel_value = PendingSpliceInfoPre ::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution_satoshis);
8026- let post_balance = PendingSpliceInfoPre ::add_checked(self.context.value_to_self_msat, our_funding_contribution);
8025+ let post_channel_value = PendingSplice ::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution_satoshis);
8026+ let post_balance = PendingSplice ::add_checked(self.context.value_to_self_msat, our_funding_contribution);
80278027 // Early check for reserve requirement, assuming maximum balance of full channel value
80288028 // This will also be checked later at tx_complete
80298029 let _res = self.context.check_balance_meets_reserve_requirements(post_balance, post_channel_value)?;
@@ -12142,9 +12142,9 @@ mod tests {
1214212142
1214312143 #[cfg(all(test, splicing))]
1214412144 fn get_pre_and_post(pre_channel_value: u64, our_funding_contribution: i64, their_funding_contribution: i64) -> (u64, u64) {
12145- use crate::ln::channel::PendingSpliceInfoPre ;
12145+ use crate::ln::channel::PendingSplice ;
1214612146
12147- let post_channel_value = PendingSpliceInfoPre ::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution);
12147+ let post_channel_value = PendingSplice ::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution);
1214812148 (pre_channel_value, post_channel_value)
1214912149 }
1215012150
0 commit comments