@@ -2133,38 +2133,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
21332133 }
21342134 }
21352135
2136- /// Only allowed after [`Self::channel_transaction_parameters`] is set.
2137- fn get_funding_created_msg<L: Deref>(&mut self, logger: &L) -> Option<msgs::FundingCreated> where L::Target: Logger {
2138- let counterparty_keys = self.build_remote_transaction_keys();
2139- let counterparty_initial_commitment_tx = self.build_commitment_transaction(self.cur_counterparty_commitment_transaction_number, &counterparty_keys, false, false, logger).tx;
2140- let signature = match &self.holder_signer {
2141- // TODO (taproot|arik): move match into calling method for Taproot
2142- ChannelSignerType::Ecdsa(ecdsa) => {
2143- ecdsa.sign_counterparty_commitment(&counterparty_initial_commitment_tx, Vec::new(), &self.secp_ctx)
2144- .map(|(sig, _)| sig).ok()?
2145- },
2146- // TODO (taproot|arik)
2147- #[cfg(taproot)]
2148- _ => todo!()
2149- };
2150-
2151- if self.signer_pending_funding {
2152- log_trace!(logger, "Counterparty commitment signature ready for funding_created message: clearing signer_pending_funding");
2153- self.signer_pending_funding = false;
2154- }
2155-
2156- Some(msgs::FundingCreated {
2157- temporary_channel_id: self.temporary_channel_id.unwrap(),
2158- funding_txid: self.channel_transaction_parameters.funding_outpoint.as_ref().unwrap().txid,
2159- funding_output_index: self.channel_transaction_parameters.funding_outpoint.as_ref().unwrap().index,
2160- signature,
2161- #[cfg(taproot)]
2162- partial_signature_with_nonce: None,
2163- #[cfg(taproot)]
2164- next_local_nonce: None,
2165- })
2166- }
2167-
21682136 /// Only allowed after [`Self::channel_transaction_parameters`] is set.
21692137 fn get_funding_signed_msg<L: Deref>(&mut self, logger: &L) -> (CommitmentTransaction, Option<msgs::FundingSigned>) where L::Target: Logger {
21702138 let counterparty_keys = self.build_remote_transaction_keys();
@@ -6028,6 +5996,38 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
60285996 })
60295997 }
60305998
5999+ /// Only allowed after [`Self::channel_transaction_parameters`] is set.
6000+ fn get_funding_created_msg<L: Deref>(&mut self, logger: &L) -> Option<msgs::FundingCreated> where L::Target: Logger {
6001+ let counterparty_keys = self.context.build_remote_transaction_keys();
6002+ let counterparty_initial_commitment_tx = self.context.build_commitment_transaction(self.context.cur_counterparty_commitment_transaction_number, &counterparty_keys, false, false, logger).tx;
6003+ let signature = match &self.context.holder_signer {
6004+ // TODO (taproot|arik): move match into calling method for Taproot
6005+ ChannelSignerType::Ecdsa(ecdsa) => {
6006+ ecdsa.sign_counterparty_commitment(&counterparty_initial_commitment_tx, Vec::new(), &self.context.secp_ctx)
6007+ .map(|(sig, _)| sig).ok()?
6008+ },
6009+ // TODO (taproot|arik)
6010+ #[cfg(taproot)]
6011+ _ => todo!()
6012+ };
6013+
6014+ if self.context.signer_pending_funding {
6015+ log_trace!(logger, "Counterparty commitment signature ready for funding_created message: clearing signer_pending_funding");
6016+ self.context.signer_pending_funding = false;
6017+ }
6018+
6019+ Some(msgs::FundingCreated {
6020+ temporary_channel_id: self.context.temporary_channel_id.unwrap(),
6021+ funding_txid: self.context.channel_transaction_parameters.funding_outpoint.as_ref().unwrap().txid,
6022+ funding_output_index: self.context.channel_transaction_parameters.funding_outpoint.as_ref().unwrap().index,
6023+ signature,
6024+ #[cfg(taproot)]
6025+ partial_signature_with_nonce: None,
6026+ #[cfg(taproot)]
6027+ next_local_nonce: None,
6028+ })
6029+ }
6030+
60316031 /// Updates channel state with knowledge of the funding transaction's txid/index, and generates
60326032 /// a funding_created message for the remote peer.
60336033 /// Panics if called at some time other than immediately after initial handshake, if called twice,
@@ -6068,7 +6068,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
60686068 self.context.funding_transaction = Some(funding_transaction);
60696069 self.context.is_batch_funding = Some(()).filter(|_| is_batch_funding);
60706070
6071- let funding_created = self.context. get_funding_created_msg(logger);
6071+ let funding_created = self.get_funding_created_msg(logger);
60726072 if funding_created.is_none() {
60736073 if !self.context.signer_pending_funding {
60746074 log_trace!(logger, "funding_created awaiting signer; setting signer_pending_funding");
@@ -6415,7 +6415,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
64156415 pub fn signer_maybe_unblocked<L: Deref>(&mut self, logger: &L) -> Option<msgs::FundingCreated> where L::Target: Logger {
64166416 if self.context.signer_pending_funding && self.context.is_outbound() {
64176417 log_trace!(logger, "Signer unblocked a funding_created");
6418- self.context. get_funding_created_msg(logger)
6418+ self.get_funding_created_msg(logger)
64196419 } else { None }
64206420 }
64216421}
0 commit comments