@@ -6010,6 +6010,22 @@ where
6010
6010
&[]
6011
6011
}
6012
6012
6013
+ #[cfg(splicing)]
6014
+ fn funding_and_pending_funding_iter_mut(&mut self) -> impl Iterator<Item = &mut FundingScope> {
6015
+ core::iter::once(&mut self.funding).chain(
6016
+ self.pending_splice
6017
+ .as_mut()
6018
+ .map(|pending_splice| pending_splice.pending_funding.as_mut_slice())
6019
+ .unwrap_or(&mut [])
6020
+ .iter_mut(),
6021
+ )
6022
+ }
6023
+
6024
+ #[cfg(not(splicing))]
6025
+ fn funding_and_pending_funding_iter_mut(&mut self) -> impl Iterator<Item = &mut FundingScope> {
6026
+ core::iter::once(&mut self.funding)
6027
+ }
6028
+
6013
6029
#[rustfmt::skip]
6014
6030
fn check_remote_fee<F: Deref, L: Deref>(
6015
6031
channel_type: &ChannelTypeFeatures, fee_estimator: &LowerBoundedFeeEstimator<F>,
@@ -7280,13 +7296,7 @@ where
7280
7296
7281
7297
#[cfg(any(test, fuzzing))]
7282
7298
{
7283
- for funding in core::iter::once(&mut self.funding).chain(
7284
- self.pending_splice
7285
- .as_mut()
7286
- .map(|pending_splice| pending_splice.pending_funding.as_mut_slice())
7287
- .unwrap_or(&mut [])
7288
- .iter_mut(),
7289
- ) {
7299
+ for funding in self.funding_and_pending_funding_iter_mut() {
7290
7300
*funding.next_local_commitment_tx_fee_info_cached.lock().unwrap() = None;
7291
7301
*funding.next_remote_commitment_tx_fee_info_cached.lock().unwrap() = None;
7292
7302
}
@@ -7489,21 +7499,10 @@ where
7489
7499
}
7490
7500
}
7491
7501
7492
- #[cfg(splicing)]
7493
- for funding in core::iter::once(&mut self.funding).chain(
7494
- self.pending_splice
7495
- .as_mut()
7496
- .map(|pending_splice| pending_splice.pending_funding.as_mut_slice())
7497
- .unwrap_or(&mut [])
7498
- .iter_mut(),
7499
- ) {
7502
+ for funding in self.funding_and_pending_funding_iter_mut() {
7500
7503
funding.value_to_self_msat =
7501
7504
(funding.value_to_self_msat as i64 + value_to_self_msat_diff) as u64;
7502
7505
}
7503
- #[cfg(not(splicing))] {
7504
- self.funding.value_to_self_msat =
7505
- (self.funding.value_to_self_msat as i64 + value_to_self_msat_diff) as u64;
7506
- }
7507
7506
7508
7507
if let Some((feerate, update_state)) = self.context.pending_update_fee {
7509
7508
match update_state {
@@ -9916,21 +9915,9 @@ where
9916
9915
where
9917
9916
L::Target: Logger,
9918
9917
{
9919
- let unconfirmed_funding = (self.funding.get_funding_txid() == Some(*txid))
9920
- .then(|| &mut self.funding)
9921
- .or_else(|| {
9922
- #[cfg(splicing)] {
9923
- self.pending_splice.as_mut().and_then(|pending_splice| {
9924
- pending_splice
9925
- .pending_funding
9926
- .iter_mut()
9927
- .find(|funding| funding.get_funding_txid() == Some(*txid))
9928
- })
9929
- }
9930
- #[cfg(not(splicing))] {
9931
- None
9932
- }
9933
- });
9918
+ let unconfirmed_funding = self
9919
+ .funding_and_pending_funding_iter_mut()
9920
+ .find(|funding| funding.get_funding_txid() == Some(*txid));
9934
9921
9935
9922
if let Some(funding) = unconfirmed_funding {
9936
9923
if funding.funding_tx_confirmation_height != 0 {
0 commit comments