@@ -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 {
@@ -4290,7 +4290,7 @@ pub(super) struct Channel<SP: Deref> where SP::Target: SignerProvider {
4290
4290
pub interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
4291
4291
/// Info about an in-progress, pending splice (if any), on the pre-splice channel
4292
4292
#[cfg(splicing)]
4293
- pending_splice_pre: Option<PendingSpliceInfoPre >,
4293
+ pending_splice_pre: Option<PendingSplice >,
4294
4294
}
4295
4295
4296
4296
#[cfg(any(test, fuzzing))]
@@ -7929,17 +7929,17 @@ impl<SP: Deref> Channel<SP> where
7929
7929
// (Cannot test for miminum required post-splice channel value)
7930
7930
7931
7931
// 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() ;
7935
7935
if sum_input < our_funding_contribution_satoshis {
7936
7936
return Err(ChannelError::Warn(format!(
7937
7937
"Provided inputs are insufficient for our contribution, {} {}",
7938
7938
sum_input, our_funding_contribution_satoshis,
7939
7939
)));
7940
7940
}
7941
7941
7942
- self.pending_splice_pre = Some(PendingSpliceInfoPre {
7942
+ self.pending_splice_pre = Some(PendingSplice {
7943
7943
our_funding_contribution: our_funding_contribution_satoshis,
7944
7944
});
7945
7945
@@ -7985,8 +7985,8 @@ impl<SP: Deref> Channel<SP> where
7985
7985
)));
7986
7986
}
7987
7987
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);
7990
7990
// Early check for reserve requirement, assuming maximum balance of full channel value
7991
7991
// This will also be checked later at tx_complete
7992
7992
let _res = self.context.check_balance_meets_reserve_requirements(post_balance, post_channel_value)?;
@@ -8014,8 +8014,8 @@ impl<SP: Deref> Channel<SP> where
8014
8014
let our_funding_contribution = pending_splice.our_funding_contribution;
8015
8015
8016
8016
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);
8019
8019
// Early check for reserve requirement, assuming maximum balance of full channel value
8020
8020
// This will also be checked later at tx_complete
8021
8021
let _res = self.context.check_balance_meets_reserve_requirements(post_balance, post_channel_value)?;
@@ -12134,9 +12134,9 @@ mod tests {
12134
12134
12135
12135
#[cfg(all(test, splicing))]
12136
12136
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 ;
12138
12138
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);
12140
12140
(pre_channel_value, post_channel_value)
12141
12141
}
12142
12142
0 commit comments