Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use crate::ln::channelmanager::{
MAX_LOCAL_BREAKDOWN_TIMEOUT, MIN_CLTV_EXPIRY_DELTA,
};
use crate::ln::funding::{
FeeRateAdjustmentError, FundingContribution, FundingTemplate, FundingTxInput, PriorContribution,
FeeRateAdjustmentError, FundingContribution, FundingTemplate, FundingTxInput,
};
use crate::ln::interactivetxs::{
AbortReason, HandleTxCompleteValue, InteractiveTxConstructor, InteractiveTxConstructorArgs,
Expand Down Expand Up @@ -12333,6 +12333,17 @@ where
});
}

let spliceable_balance = self
.get_holder_counterparty_balances_floor_incl_fee(&self.funding)
.map(|(h, _)| h)
.map_err(|e| APIError::ChannelUnavailable {
err: format!(
"Channel {} cannot be spliced at this time: {}",
self.context.channel_id(),
e
),
})?;

let (min_rbf_feerate, prior_contribution) = if self.is_rbf_compatible().is_err() {
// Channel can never RBF (e.g., zero-conf).
(None, None)
Expand Down Expand Up @@ -12365,17 +12376,7 @@ where
.as_ref()
.and_then(|pending_splice| pending_splice.contributions.last())
{
let holder_balance = self
.get_holder_counterparty_balances_floor_incl_fee(&self.funding)
.map(|(h, _)| h)
.map_err(|e| APIError::ChannelUnavailable {
err: format!(
"Channel {} cannot be spliced at this time: {}",
self.context.channel_id(),
e
),
})?;
Some(PriorContribution::new(prior.clone(), holder_balance))
Some(prior.clone())
} else {
None
}
Expand All @@ -12397,7 +12398,12 @@ where
satisfaction_weight: EMPTY_SCRIPT_SIG_WEIGHT + FUNDING_TRANSACTION_WITNESS_WEIGHT,
};

Ok(FundingTemplate::new(Some(shared_input), min_rbf_feerate, prior_contribution))
Ok(FundingTemplate::new(
Some(shared_input),
min_rbf_feerate,
prior_contribution,
spliceable_balance,
))
}

/// Returns whether this channel can ever RBF, independent of splice state.
Expand Down
Loading
Loading