@@ -1783,13 +1783,10 @@ where
17831783 L::Target: Logger,
17841784 {
17851785 let logger = WithChannelContext::from(logger, self.context(), None);
1786- if let Ok(mut negotiating_channel) = self.as_negotiating_channel() {
1787- let (commitment_signed, event) =
1788- negotiating_channel.funding_tx_constructed(signing_session, &&logger)?;
1789- Ok((commitment_signed, event))
1790- } else {
1791- Err(ChannelError::Warn("Got a tx_complete message with no interactive transaction construction expected or in-progress".to_owned()))
1792- }
1786+ let mut negotiating_channel = self.as_negotiating_channel()?;
1787+ let (commitment_signed, event) =
1788+ negotiating_channel.funding_tx_constructed(signing_session, &&logger)?;
1789+ Ok((commitment_signed, event))
17931790 }
17941791
17951792 pub fn force_shutdown(
@@ -2198,45 +2195,26 @@ impl FundingScope {
21982195 {
21992196 let post_value_to_self_msat_signed = (prev_funding.value_to_self_msat as i64)
22002197 .saturating_add(our_funding_contribution_sats * 1000);
2201- if post_value_to_self_msat_signed < 0 {
2202- // Splice out and more than our balance, error
2203- return Err(ChannelError::Warn(format!(
2204- "Cannot splice out more than the current balance, {} sats, {} msats",
2205- post_value_to_self_msat_signed, prev_funding.value_to_self_msat
2206- )));
2207- }
22082198 debug_assert!(post_value_to_self_msat_signed >= 0);
22092199 let post_value_to_self_msat = post_value_to_self_msat_signed as u64;
22102200
2211- let prev_funding_txid = prev_funding
2212- .channel_transaction_parameters
2213- .funding_outpoint
2214- .map(|outpoint| outpoint.txid);
2201+ let prev_funding_txid = prev_funding.get_funding_txid();
22152202 let holder_pubkeys = match &context.holder_signer {
22162203 ChannelSignerType::Ecdsa(ecdsa) => ecdsa.pubkeys(prev_funding_txid, &context.secp_ctx),
22172204 // TODO (taproot|arik)
22182205 #[cfg(taproot)]
22192206 _ => todo!(),
22202207 };
2208+ let channel_parameters = &prev_funding.channel_transaction_parameters;
22212209 let mut post_channel_transaction_parameters = ChannelTransactionParameters {
22222210 holder_pubkeys,
2223- holder_selected_contest_delay: prev_funding
2224- .channel_transaction_parameters
2225- .holder_selected_contest_delay,
2211+ holder_selected_contest_delay: channel_parameters.holder_selected_contest_delay,
22262212 // The 'outbound' attribute doesn't change, even if the splice initiator is the other node
2227- is_outbound_from_holder: prev_funding
2228- .channel_transaction_parameters
2229- .is_outbound_from_holder,
2230- counterparty_parameters: prev_funding
2231- .channel_transaction_parameters
2232- .counterparty_parameters
2233- .clone(),
2213+ is_outbound_from_holder: channel_parameters.is_outbound_from_holder,
2214+ counterparty_parameters: channel_parameters.counterparty_parameters.clone(),
22342215 funding_outpoint: None, // filled later
22352216 splice_parent_funding_txid: prev_funding_txid,
2236- channel_type_features: prev_funding
2237- .channel_transaction_parameters
2238- .channel_type_features
2239- .clone(),
2217+ channel_type_features: channel_parameters.channel_type_features.clone(),
22402218 channel_value_satoshis: post_channel_value,
22412219 };
22422220 // Update the splicing 'tweak', this will rotate the keys in the signer
@@ -2897,7 +2875,7 @@ where
28972875/// Can be produced by:
28982876/// - [`PendingV2Channel`], at V2 channel open, and
28992877/// - [`FundedChannel`], when splicing.
2900- pub struct NegotiatingChannelView<'a, SP: Deref>
2878+ pub(super) struct NegotiatingChannelView<'a, SP: Deref>
29012879where
29022880 SP::Target: SignerProvider,
29032881{
0 commit comments