@@ -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 {
@@ -4290,7 +4290,7 @@ pub(super) struct Channel<SP: Deref> where SP::Target: SignerProvider {
42904290 pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
42914291 /// Info about an in-progress, pending splice (if any), on the pre-splice channel
42924292 #[cfg(splicing)]
4293- pending_splice_pre: Option<PendingSpliceInfoPre >,
4293+ pending_splice_pre: Option<PendingSplice >,
42944294}
42954295
42964296#[cfg(any(test, fuzzing))]
@@ -7929,17 +7929,17 @@ impl<SP: Deref> Channel<SP> where
79297929 // (Cannot test for miminum required post-splice channel value)
79307930
79317931 // Check that inputs are sufficient to cover our contribution
7932- let sum_input: i64 = our_funding_inputs.into_iter().fold(0, |acc, i|
7933- acc + i.1. output.get(i.0 .previous_output.vout as usize).map(|tx| tx.value.to_sat() as i64).unwrap_or(0)
7934- );
7932+ let sum_input: i64 = our_funding_inputs.into_iter().map(
7933+ |(txin, tx)| tx. output.get(txin .previous_output.vout as usize).map(|tx| tx.value.to_sat() as i64).unwrap_or(0)
7934+ ).sum() ;
79357935 if sum_input < our_funding_contribution_satoshis {
79367936 return Err(ChannelError::Warn(format!(
79377937 "Provided inputs are insufficient for our contribution, {} {}",
79387938 sum_input, our_funding_contribution_satoshis,
79397939 )));
79407940 }
79417941
7942- self.pending_splice_pre = Some(PendingSpliceInfoPre {
7942+ self.pending_splice_pre = Some(PendingSplice {
79437943 our_funding_contribution: our_funding_contribution_satoshis,
79447944 });
79457945
@@ -7985,8 +7985,8 @@ impl<SP: Deref> Channel<SP> where
79857985 )));
79867986 }
79877987
7988- let post_channel_value = PendingSpliceInfoPre ::compute_post_value(pre_channel_value, their_funding_contribution_satoshis, our_funding_contribution_satoshis);
7989- let post_balance = PendingSpliceInfoPre ::add_checked(self.context.value_to_self_msat, our_funding_contribution_satoshis);
7988+ let post_channel_value = PendingSplice ::compute_post_value(pre_channel_value, their_funding_contribution_satoshis, our_funding_contribution_satoshis);
7989+ let post_balance = PendingSplice ::add_checked(self.context.value_to_self_msat, our_funding_contribution_satoshis);
79907990 // Early check for reserve requirement, assuming maximum balance of full channel value
79917991 // This will also be checked later at tx_complete
79927992 let _res = self.context.check_balance_meets_reserve_requirements(post_balance, post_channel_value)?;
@@ -8014,8 +8014,8 @@ impl<SP: Deref> Channel<SP> where
80148014 let our_funding_contribution = pending_splice.our_funding_contribution;
80158015
80168016 let pre_channel_value = self.context.get_value_satoshis();
8017- let post_channel_value = PendingSpliceInfoPre ::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution_satoshis);
8018- let post_balance = PendingSpliceInfoPre ::add_checked(self.context.value_to_self_msat, our_funding_contribution);
8017+ let post_channel_value = PendingSplice ::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution_satoshis);
8018+ let post_balance = PendingSplice ::add_checked(self.context.value_to_self_msat, our_funding_contribution);
80198019 // Early check for reserve requirement, assuming maximum balance of full channel value
80208020 // This will also be checked later at tx_complete
80218021 let _res = self.context.check_balance_meets_reserve_requirements(post_balance, post_channel_value)?;
@@ -12134,9 +12134,9 @@ mod tests {
1213412134
1213512135 #[cfg(all(test, splicing))]
1213612136 fn get_pre_and_post(pre_channel_value: u64, our_funding_contribution: i64, their_funding_contribution: i64) -> (u64, u64) {
12137- use crate::ln::channel::PendingSpliceInfoPre ;
12137+ use crate::ln::channel::PendingSplice ;
1213812138
12139- let post_channel_value = PendingSpliceInfoPre ::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution);
12139+ let post_channel_value = PendingSplice ::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution);
1214012140 (pre_channel_value, post_channel_value)
1214112141 }
1214212142
0 commit comments