@@ -1184,12 +1184,12 @@ impl UnfundedChannelContext {
1184
1184
/// Info about a pending splice, used in the pre-splice channel
1185
1185
#[cfg(splicing)]
1186
1186
#[derive(Clone)]
1187
- struct PendingSpliceInfoPre {
1187
+ struct PendingSplice {
1188
1188
pub our_funding_contribution: i64,
1189
1189
}
1190
1190
1191
1191
#[cfg(splicing)]
1192
- impl PendingSpliceInfoPre {
1192
+ impl PendingSplice {
1193
1193
#[inline]
1194
1194
fn add_checked(base: u64, delta: i64) -> u64 {
1195
1195
if delta >= 0 {
@@ -4298,7 +4298,7 @@ pub(super) struct Channel<SP: Deref> where SP::Target: SignerProvider {
4298
4298
pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
4299
4299
/// Info about an in-progress, pending splice (if any), on the pre-splice channel
4300
4300
#[cfg(splicing)]
4301
- pending_splice_pre: Option<PendingSpliceInfoPre >,
4301
+ pending_splice_pre: Option<PendingSplice >,
4302
4302
}
4303
4303
4304
4304
#[cfg(any(test, fuzzing))]
@@ -7937,17 +7937,17 @@ impl<SP: Deref> Channel<SP> where
7937
7937
// (Cannot test for miminum required post-splice channel value)
7938
7938
7939
7939
// 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() ;
7943
7943
if sum_input < our_funding_contribution_satoshis {
7944
7944
return Err(ChannelError::Warn(format!(
7945
7945
"Provided inputs are insufficient for our contribution, {} {}",
7946
7946
sum_input, our_funding_contribution_satoshis,
7947
7947
)));
7948
7948
}
7949
7949
7950
- self.pending_splice_pre = Some(PendingSpliceInfoPre {
7950
+ self.pending_splice_pre = Some(PendingSplice {
7951
7951
our_funding_contribution: our_funding_contribution_satoshis,
7952
7952
});
7953
7953
@@ -7993,8 +7993,8 @@ impl<SP: Deref> Channel<SP> where
7993
7993
)));
7994
7994
}
7995
7995
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);
7998
7998
// Early check for reserve requirement, assuming maximum balance of full channel value
7999
7999
// This will also be checked later at tx_complete
8000
8000
let _res = self.context.check_balance_meets_reserve_requirements(post_balance, post_channel_value)?;
@@ -8022,8 +8022,8 @@ impl<SP: Deref> Channel<SP> where
8022
8022
let our_funding_contribution = pending_splice.our_funding_contribution;
8023
8023
8024
8024
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);
8027
8027
// Early check for reserve requirement, assuming maximum balance of full channel value
8028
8028
// This will also be checked later at tx_complete
8029
8029
let _res = self.context.check_balance_meets_reserve_requirements(post_balance, post_channel_value)?;
@@ -12142,9 +12142,9 @@ mod tests {
12142
12142
12143
12143
#[cfg(all(test, splicing))]
12144
12144
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 ;
12146
12146
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);
12148
12148
(pre_channel_value, post_channel_value)
12149
12149
}
12150
12150
0 commit comments