@@ -2028,18 +2028,32 @@ where
20282028 | NegotiatingFundingFlags::THEIR_INIT_SENT
20292029 ),
20302030 );
2031+ chan.context.assert_no_commitment_advancement(
2032+ chan.unfunded_context.transaction_number(),
2033+ "initial commitment_signed",
2034+ );
2035+
2036+ chan.context.channel_state =
2037+ ChannelState::FundingNegotiated(FundingNegotiatedFlags::new());
2038+ chan.funding.channel_transaction_parameters.funding_outpoint =
2039+ Some(funding_outpoint);
20312040
20322041 let interactive_tx_constructor = chan
20332042 .interactive_tx_constructor
20342043 .take()
20352044 .expect("PendingV2Channel::interactive_tx_constructor should be set");
2036- let commitment_signed = chan.context.funding_tx_constructed(
2037- &mut chan.funding,
2038- funding_outpoint,
2039- false,
2040- chan.unfunded_context.transaction_number(),
2041- &&logger,
2042- )?;
2045+
2046+ let commitment_signed =
2047+ chan.context.get_initial_commitment_signed_v2(&chan.funding, &&logger);
2048+ let commitment_signed = match commitment_signed {
2049+ Some(commitment_signed) => commitment_signed,
2050+ // TODO(dual_funding): Support async signing
2051+ None => {
2052+ return Err(AbortReason::InternalError(
2053+ "Failed to compute commitment_signed signatures",
2054+ ));
2055+ },
2056+ };
20432057
20442058 (interactive_tx_constructor, commitment_signed)
20452059 },
@@ -2068,14 +2082,11 @@ where
20682082 )
20692083 })
20702084 .and_then(|(is_initiator, mut funding, interactive_tx_constructor)| {
2071- match chan.context.funding_tx_constructed(
2072- &mut funding,
2073- funding_outpoint,
2074- true,
2075- chan.holder_commitment_point.next_transaction_number(),
2076- &&logger,
2077- ) {
2078- Ok(commitment_signed) => {
2085+ funding.channel_transaction_parameters.funding_outpoint =
2086+ Some(funding_outpoint);
2087+ match chan.context.get_initial_commitment_signed_v2(&funding, &&logger)
2088+ {
2089+ Some(commitment_signed) => {
20792090 // Advance the state
20802091 pending_splice.funding_negotiation =
20812092 Some(FundingNegotiation::AwaitingSignatures {
@@ -2084,14 +2095,17 @@ where
20842095 });
20852096 Ok((interactive_tx_constructor, commitment_signed))
20862097 },
2087- Err(e) => {
2098+ // TODO(splicing): Support async signing
2099+ None => {
20882100 // Restore the taken state for later error handling
20892101 pending_splice.funding_negotiation =
20902102 Some(FundingNegotiation::ConstructingTransaction {
20912103 funding,
20922104 interactive_tx_constructor,
20932105 });
2094- Err(e)
2106+ Err(AbortReason::InternalError(
2107+ "Failed to compute commitment_signed signatures",
2108+ ))
20952109 },
20962110 }
20972111 })?
@@ -6189,33 +6203,6 @@ where
61896203 Ok(())
61906204 }
61916205
6192- #[rustfmt::skip]
6193- fn funding_tx_constructed<L: Deref>(
6194- &mut self, funding: &mut FundingScope, funding_outpoint: OutPoint, is_splice: bool,
6195- holder_commitment_transaction_number: u64, logger: &L,
6196- ) -> Result<msgs::CommitmentSigned, AbortReason>
6197- where
6198- L::Target: Logger
6199- {
6200- funding.channel_transaction_parameters.funding_outpoint = Some(funding_outpoint);
6201-
6202- if !is_splice {
6203- self.assert_no_commitment_advancement(holder_commitment_transaction_number, "initial commitment_signed");
6204- self.channel_state = ChannelState::FundingNegotiated(FundingNegotiatedFlags::new());
6205- }
6206-
6207- let commitment_signed = self.get_initial_commitment_signed_v2(&funding, logger);
6208- let commitment_signed = match commitment_signed {
6209- Some(commitment_signed) => commitment_signed,
6210- // TODO(splicing): Support async signing
6211- None => {
6212- return Err(AbortReason::InternalError("Failed to compute commitment_signed signatures"));
6213- },
6214- };
6215-
6216- Ok(commitment_signed)
6217- }
6218-
62196206 /// Asserts that the commitment tx numbers have not advanced from their initial number.
62206207 fn assert_no_commitment_advancement(
62216208 &self, holder_commitment_transaction_number: u64, msg_name: &str,
0 commit comments