@@ -2406,38 +2406,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
24062406 }
24072407 }
24082408
2409- /// Only allowed after [`Self::channel_transaction_parameters`] is set.
2410- fn get_funding_created_msg<L: Deref>(&mut self, logger: &L) -> Option<msgs::FundingCreated> where L::Target: Logger {
2411- let counterparty_keys = self.build_remote_transaction_keys();
2412- let counterparty_initial_commitment_tx = self.build_commitment_transaction(self.cur_counterparty_commitment_transaction_number, &counterparty_keys, false, false, logger).tx;
2413- let signature = match &self.holder_signer {
2414- // TODO (taproot|arik): move match into calling method for Taproot
2415- ChannelSignerType::Ecdsa(ecdsa) => {
2416- ecdsa.sign_counterparty_commitment(&counterparty_initial_commitment_tx, Vec::new(), Vec::new(), &self.secp_ctx)
2417- .map(|(sig, _)| sig).ok()?
2418- },
2419- // TODO (taproot|arik)
2420- #[cfg(taproot)]
2421- _ => todo!()
2422- };
2423-
2424- if self.signer_pending_funding {
2425- log_trace!(logger, "Counterparty commitment signature ready for funding_created message: clearing signer_pending_funding");
2426- self.signer_pending_funding = false;
2427- }
2428-
2429- Some(msgs::FundingCreated {
2430- temporary_channel_id: self.temporary_channel_id.unwrap(),
2431- funding_txid: self.channel_transaction_parameters.funding_outpoint.as_ref().unwrap().txid,
2432- funding_output_index: self.channel_transaction_parameters.funding_outpoint.as_ref().unwrap().index,
2433- signature,
2434- #[cfg(taproot)]
2435- partial_signature_with_nonce: None,
2436- #[cfg(taproot)]
2437- next_local_nonce: None,
2438- })
2439- }
2440-
24412409 /// Only allowed after [`Self::channel_transaction_parameters`] is set.
24422410 fn get_funding_signed_msg<L: Deref>(&mut self, logger: &L) -> (CommitmentTransaction, Option<msgs::FundingSigned>) where L::Target: Logger {
24432411 let counterparty_keys = self.build_remote_transaction_keys();
@@ -6339,6 +6307,38 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
63396307 })
63406308 }
63416309
6310+ /// Only allowed after [`ChannelContext::channel_transaction_parameters`] is set.
6311+ fn get_funding_created_msg<L: Deref>(&mut self, logger: &L) -> Option<msgs::FundingCreated> where L::Target: Logger {
6312+ let counterparty_keys = self.context.build_remote_transaction_keys();
6313+ let counterparty_initial_commitment_tx = self.context.build_commitment_transaction(self.context.cur_counterparty_commitment_transaction_number, &counterparty_keys, false, false, logger).tx;
6314+ let signature = match &self.context.holder_signer {
6315+ // TODO (taproot|arik): move match into calling method for Taproot
6316+ ChannelSignerType::Ecdsa(ecdsa) => {
6317+ ecdsa.sign_counterparty_commitment(&counterparty_initial_commitment_tx, Vec::new(), Vec::new(), &self.context.secp_ctx)
6318+ .map(|(sig, _)| sig).ok()?
6319+ },
6320+ // TODO (taproot|arik)
6321+ #[cfg(taproot)]
6322+ _ => todo!()
6323+ };
6324+
6325+ if self.context.signer_pending_funding {
6326+ log_trace!(logger, "Counterparty commitment signature ready for funding_created message: clearing signer_pending_funding");
6327+ self.context.signer_pending_funding = false;
6328+ }
6329+
6330+ Some(msgs::FundingCreated {
6331+ temporary_channel_id: self.context.temporary_channel_id.unwrap(),
6332+ funding_txid: self.context.channel_transaction_parameters.funding_outpoint.as_ref().unwrap().txid,
6333+ funding_output_index: self.context.channel_transaction_parameters.funding_outpoint.as_ref().unwrap().index,
6334+ signature,
6335+ #[cfg(taproot)]
6336+ partial_signature_with_nonce: None,
6337+ #[cfg(taproot)]
6338+ next_local_nonce: None,
6339+ })
6340+ }
6341+
63426342 /// Updates channel state with knowledge of the funding transaction's txid/index, and generates
63436343 /// a funding_created message for the remote peer.
63446344 /// Panics if called at some time other than immediately after initial handshake, if called twice,
@@ -6382,7 +6382,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
63826382 self.context.funding_transaction = Some(funding_transaction);
63836383 self.context.is_batch_funding = Some(()).filter(|_| is_batch_funding);
63846384
6385- let funding_created = self.context. get_funding_created_msg(logger);
6385+ let funding_created = self.get_funding_created_msg(logger);
63866386 if funding_created.is_none() {
63876387 if !self.context.signer_pending_funding {
63886388 log_trace!(logger, "funding_created awaiting signer; setting signer_pending_funding");
@@ -6736,7 +6736,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
67366736 pub fn signer_maybe_unblocked<L: Deref>(&mut self, logger: &L) -> Option<msgs::FundingCreated> where L::Target: Logger {
67376737 if self.context.signer_pending_funding && self.context.is_outbound() {
67386738 log_trace!(logger, "Signer unblocked a funding_created");
6739- self.context. get_funding_created_msg(logger)
6739+ self.get_funding_created_msg(logger)
67406740 } else { None }
67416741 }
67426742}
0 commit comments