@@ -1781,13 +1781,10 @@ where
17811781 L::Target: Logger,
17821782 {
17831783 let logger = WithChannelContext::from(logger, self.context(), None);
1784- if let Ok(mut negotiating_channel) = self.as_negotiating_channel() {
1785- let (commitment_signed, event) =
1786- negotiating_channel.funding_tx_constructed(signing_session, &&logger)?;
1787- Ok((commitment_signed, event))
1788- } else {
1789- Err(ChannelError::Warn("Got a tx_complete message with no interactive transaction construction expected or in-progress".to_owned()))
1790- }
1784+ let mut negotiating_channel = self.as_negotiating_channel()?;
1785+ let (commitment_signed, event) =
1786+ negotiating_channel.funding_tx_constructed(signing_session, &&logger)?;
1787+ Ok((commitment_signed, event))
17911788 }
17921789
17931790 pub fn force_shutdown(
@@ -2171,45 +2168,26 @@ impl FundingScope {
21712168 {
21722169 let post_value_to_self_msat_signed = (prev_funding.value_to_self_msat as i64)
21732170 .saturating_add(our_funding_contribution_sats * 1000);
2174- if post_value_to_self_msat_signed < 0 {
2175- // Splice out and more than our balance, error
2176- return Err(ChannelError::Warn(format!(
2177- "Cannot splice out more than the current balance, {} sats, {} msats",
2178- post_value_to_self_msat_signed, prev_funding.value_to_self_msat
2179- )));
2180- }
21812171 debug_assert!(post_value_to_self_msat_signed >= 0);
21822172 let post_value_to_self_msat = post_value_to_self_msat_signed as u64;
21832173
2184- let prev_funding_txid = prev_funding
2185- .channel_transaction_parameters
2186- .funding_outpoint
2187- .map(|outpoint| outpoint.txid);
2174+ let prev_funding_txid = prev_funding.get_funding_txid();
21882175 let holder_pubkeys = match &context.holder_signer {
21892176 ChannelSignerType::Ecdsa(ecdsa) => ecdsa.pubkeys(prev_funding_txid, &context.secp_ctx),
21902177 // TODO (taproot|arik)
21912178 #[cfg(taproot)]
21922179 _ => todo!(),
21932180 };
2181+ let channel_parameters = &prev_funding.channel_transaction_parameters;
21942182 let mut post_channel_transaction_parameters = ChannelTransactionParameters {
21952183 holder_pubkeys,
2196- holder_selected_contest_delay: prev_funding
2197- .channel_transaction_parameters
2198- .holder_selected_contest_delay,
2184+ holder_selected_contest_delay: channel_parameters.holder_selected_contest_delay,
21992185 // The 'outbound' attribute doesn't change, even if the splice initiator is the other node
2200- is_outbound_from_holder: prev_funding
2201- .channel_transaction_parameters
2202- .is_outbound_from_holder,
2203- counterparty_parameters: prev_funding
2204- .channel_transaction_parameters
2205- .counterparty_parameters
2206- .clone(),
2186+ is_outbound_from_holder: channel_parameters.is_outbound_from_holder,
2187+ counterparty_parameters: channel_parameters.counterparty_parameters.clone(),
22072188 funding_outpoint: None, // filled later
22082189 splice_parent_funding_txid: prev_funding_txid,
2209- channel_type_features: prev_funding
2210- .channel_transaction_parameters
2211- .channel_type_features
2212- .clone(),
2190+ channel_type_features: channel_parameters.channel_type_features.clone(),
22132191 channel_value_satoshis: post_channel_value,
22142192 };
22152193 // Update the splicing 'tweak', this will rotate the keys in the signer
@@ -2870,7 +2848,7 @@ where
28702848/// Can be produced by:
28712849/// - [`PendingV2Channel`], at V2 channel open, and
28722850/// - [`FundedChannel`], when splicing.
2873- pub struct NegotiatingChannelView<'a, SP: Deref>
2851+ pub(super) struct NegotiatingChannelView<'a, SP: Deref>
28742852where
28752853 SP::Target: SignerProvider,
28762854{
0 commit comments