@@ -2406,38 +2406,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2406
2406
}
2407
2407
}
2408
2408
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
-
2441
2409
/// Only allowed after [`Self::channel_transaction_parameters`] is set.
2442
2410
fn get_funding_signed_msg<L: Deref>(&mut self, logger: &L) -> (CommitmentTransaction, Option<msgs::FundingSigned>) where L::Target: Logger {
2443
2411
let counterparty_keys = self.build_remote_transaction_keys();
@@ -6339,6 +6307,38 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
6339
6307
})
6340
6308
}
6341
6309
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
+
6342
6342
/// Updates channel state with knowledge of the funding transaction's txid/index, and generates
6343
6343
/// a funding_created message for the remote peer.
6344
6344
/// 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 {
6382
6382
self.context.funding_transaction = Some(funding_transaction);
6383
6383
self.context.is_batch_funding = Some(()).filter(|_| is_batch_funding);
6384
6384
6385
- let funding_created = self.context. get_funding_created_msg(logger);
6385
+ let funding_created = self.get_funding_created_msg(logger);
6386
6386
if funding_created.is_none() {
6387
6387
if !self.context.signer_pending_funding {
6388
6388
log_trace!(logger, "funding_created awaiting signer; setting signer_pending_funding");
@@ -6736,7 +6736,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
6736
6736
pub fn signer_maybe_unblocked<L: Deref>(&mut self, logger: &L) -> Option<msgs::FundingCreated> where L::Target: Logger {
6737
6737
if self.context.signer_pending_funding && self.context.is_outbound() {
6738
6738
log_trace!(logger, "Signer unblocked a funding_created");
6739
- self.context. get_funding_created_msg(logger)
6739
+ self.get_funding_created_msg(logger)
6740
6740
} else { None }
6741
6741
}
6742
6742
}
0 commit comments