@@ -56,7 +56,7 @@ use crate::ln::channelmanager::{
5656 MAX_LOCAL_BREAKDOWN_TIMEOUT, MIN_CLTV_EXPIRY_DELTA,
5757};
5858use crate::ln::funding::{
59- FeeRateAdjustmentError, FundingContribution, FundingTemplate, FundingTxInput, PriorContribution,
59+ FeeRateAdjustmentError, FundingContribution, FundingTemplate, FundingTxInput,
6060};
6161use crate::ln::interactivetxs::{
6262 AbortReason, HandleTxCompleteValue, InteractiveTxConstructor, InteractiveTxConstructorArgs,
@@ -12333,6 +12333,17 @@ where
1233312333 });
1233412334 }
1233512335
12336+ let spliceable_balance = self
12337+ .get_holder_counterparty_balances_floor_incl_fee(&self.funding)
12338+ .map(|(h, _)| h)
12339+ .map_err(|e| APIError::ChannelUnavailable {
12340+ err: format!(
12341+ "Channel {} cannot be spliced at this time: {}",
12342+ self.context.channel_id(),
12343+ e
12344+ ),
12345+ })?;
12346+
1233612347 let (min_rbf_feerate, prior_contribution) = if self.is_rbf_compatible().is_err() {
1233712348 // Channel can never RBF (e.g., zero-conf).
1233812349 (None, None)
@@ -12365,17 +12376,7 @@ where
1236512376 .as_ref()
1236612377 .and_then(|pending_splice| pending_splice.contributions.last())
1236712378 {
12368- let holder_balance = self
12369- .get_holder_counterparty_balances_floor_incl_fee(&self.funding)
12370- .map(|(h, _)| h)
12371- .map_err(|e| APIError::ChannelUnavailable {
12372- err: format!(
12373- "Channel {} cannot be spliced at this time: {}",
12374- self.context.channel_id(),
12375- e
12376- ),
12377- })?;
12378- Some(PriorContribution::new(prior.clone(), holder_balance))
12379+ Some(prior.clone())
1237912380 } else {
1238012381 None
1238112382 }
@@ -12397,7 +12398,12 @@ where
1239712398 satisfaction_weight: EMPTY_SCRIPT_SIG_WEIGHT + FUNDING_TRANSACTION_WITNESS_WEIGHT,
1239812399 };
1239912400
12400- Ok(FundingTemplate::new(Some(shared_input), min_rbf_feerate, prior_contribution))
12401+ Ok(FundingTemplate::new(
12402+ Some(shared_input),
12403+ min_rbf_feerate,
12404+ prior_contribution,
12405+ spliceable_balance,
12406+ ))
1240112407 }
1240212408
1240312409 /// Returns whether this channel can ever RBF, independent of splice state.
0 commit comments