@@ -7984,6 +7984,35 @@ where
79847984 pub fn funding_transaction_signed(
79857985 &mut self, funding_txid_signed: Txid, witnesses: Vec<Witness>,
79867986 ) -> Result<(Option<msgs::TxSignatures>, Option<Transaction>), APIError> {
7987+ if !self.context.channel_state.is_interactive_signing() {
7988+ let err =
7989+ format!("Channel {} not expecting funding signatures", self.context.channel_id);
7990+ return Err(APIError::APIMisuseError { err });
7991+ }
7992+ if self.context.channel_state.is_our_tx_signatures_ready() {
7993+ let err =
7994+ format!("Channel {} already received funding signatures", self.context.channel_id);
7995+ return Err(APIError::APIMisuseError { err });
7996+ }
7997+ #[cfg(splicing)]
7998+ if let Some(pending_splice) = self.pending_splice.as_ref() {
7999+ if !pending_splice
8000+ .funding_negotiation
8001+ .as_ref()
8002+ .map(|funding_negotiation| {
8003+ matches!(funding_negotiation, FundingNegotiation::AwaitingSignatures(_))
8004+ })
8005+ .unwrap_or(false)
8006+ {
8007+ debug_assert!(false);
8008+ let err = format!(
8009+ "Channel {} with pending splice is not expecting funding signatures yet",
8010+ self.context.channel_id
8011+ );
8012+ return Err(APIError::APIMisuseError { err });
8013+ }
8014+ }
8015+
79878016 let (tx_signatures_opt, funding_tx_opt) = self
79888017 .interactive_tx_signing_session
79898018 .as_mut()
@@ -8001,11 +8030,31 @@ where
80018030 });
80028031 }
80038032
8033+ let shared_input_signature = if let Some(splice_input_index) =
8034+ signing_session.unsigned_tx().shared_input_index()
8035+ {
8036+ let sig = match &self.context.holder_signer {
8037+ ChannelSignerType::Ecdsa(signer) => signer.sign_splice_shared_input(
8038+ &self.funding.channel_transaction_parameters,
8039+ &tx,
8040+ splice_input_index as usize,
8041+ &self.context.secp_ctx,
8042+ ),
8043+ #[cfg(taproot)]
8044+ ChannelSignerType::Taproot(_) => todo!(),
8045+ };
8046+ Some(sig)
8047+ } else {
8048+ None
8049+ };
8050+ #[cfg(splicing)]
8051+ debug_assert_eq!(self.pending_splice.is_some(), shared_input_signature.is_some());
8052+
80048053 let tx_signatures = msgs::TxSignatures {
80058054 channel_id: self.context.channel_id,
80068055 tx_hash: funding_txid_signed,
80078056 witnesses,
8008- shared_input_signature: None ,
8057+ shared_input_signature,
80098058 };
80108059 signing_session
80118060 .provide_holder_witnesses(tx_signatures, &self.context.secp_ctx)
0 commit comments