@@ -7983,6 +7983,34 @@ where
79837983 pub fn funding_transaction_signed(
79847984 &mut self, funding_txid_signed: Txid, witnesses: Vec<Witness>,
79857985 ) -> Result<(Option<msgs::TxSignatures>, Option<Transaction>), APIError> {
7986+ if !self.context.channel_state.is_interactive_signing() {
7987+ let err =
7988+ format!("Channel {} not expecting funding signatures", self.context.channel_id);
7989+ return Err(APIError::APIMisuseError { err });
7990+ }
7991+ if self.context.channel_state.is_our_tx_signatures_ready() {
7992+ let err =
7993+ format!("Channel {} already received funding signatures", self.context.channel_id);
7994+ return Err(APIError::APIMisuseError { err });
7995+ }
7996+ if let Some(pending_splice) = self.pending_splice.as_ref() {
7997+ if !pending_splice
7998+ .funding_negotiation
7999+ .as_ref()
8000+ .map(|funding_negotiation| {
8001+ matches!(funding_negotiation, FundingNegotiation::AwaitingSignatures(_))
8002+ })
8003+ .unwrap_or(false)
8004+ {
8005+ debug_assert!(false);
8006+ let err = format!(
8007+ "Channel {} with pending splice is not expecting funding signatures yet",
8008+ self.context.channel_id
8009+ );
8010+ return Err(APIError::APIMisuseError { err });
8011+ }
8012+ }
8013+
79868014 let (tx_signatures_opt, funding_tx_opt) = self
79878015 .interactive_tx_signing_session
79888016 .as_mut()
@@ -8000,11 +8028,34 @@ where
80008028 });
80018029 }
80028030
8031+ let shared_input_signature = if let Some(splice_input_index) =
8032+ signing_session.unsigned_tx().shared_input_index()
8033+ {
8034+ let sig = match &self.context.holder_signer {
8035+ ChannelSignerType::Ecdsa(signer) => signer
8036+ .sign_splicing_funding_input(
8037+ &self.funding.channel_transaction_parameters,
8038+ &tx,
8039+ splice_input_index as usize,
8040+ &self.context.secp_ctx,
8041+ )
8042+ .map_err(|_| APIError::ChannelUnavailable {
8043+ err: "Signer unavailable".to_string(),
8044+ })?,
8045+ #[cfg(taproot)]
8046+ ChannelSignerType::Taproot(_) => todo!(),
8047+ };
8048+ Some(sig)
8049+ } else {
8050+ None
8051+ };
8052+ debug_assert_eq!(self.pending_splice.is_some(), shared_input_signature.is_some());
8053+
80038054 let tx_signatures = msgs::TxSignatures {
80048055 channel_id: self.context.channel_id,
80058056 tx_hash: funding_txid_signed,
80068057 witnesses,
8007- shared_input_signature: None ,
8058+ shared_input_signature,
80088059 };
80098060 signing_session
80108061 .provide_holder_witnesses(tx_signatures, &self.context.secp_ctx)
0 commit comments