@@ -8568,16 +8568,38 @@ where
8568
8568
}
8569
8569
}
8570
8570
8571
- fn on_tx_signatures_exchange(&mut self, funding_tx: Transaction) {
8571
+ fn on_tx_signatures_exchange<'a, L: Deref>(
8572
+ &mut self, funding_tx: Transaction, best_block_height: u32,
8573
+ logger: &WithChannelContext<'a, L>,
8574
+ ) -> Option<msgs::SpliceLocked>
8575
+ where
8576
+ L::Target: Logger,
8577
+ {
8572
8578
debug_assert!(!self.context.channel_state.is_monitor_update_in_progress());
8573
8579
debug_assert!(!self.context.channel_state.is_awaiting_remote_revoke());
8574
8580
8581
+ let mut splice_locked = None;
8575
8582
if let Some(pending_splice) = self.pending_splice.as_mut() {
8576
8583
if let Some(FundingNegotiation::AwaitingSignatures { mut funding }) =
8577
8584
pending_splice.funding_negotiation.take()
8578
8585
{
8579
8586
funding.funding_transaction = Some(funding_tx);
8580
8587
pending_splice.negotiated_candidates.push(funding);
8588
+ splice_locked = pending_splice.check_get_splice_locked(
8589
+ &self.context,
8590
+ pending_splice.negotiated_candidates.len() - 1,
8591
+ best_block_height,
8592
+ );
8593
+ if let Some(splice_txid) =
8594
+ splice_locked.as_ref().map(|splice_locked| splice_locked.splice_txid)
8595
+ {
8596
+ log_info!(
8597
+ logger,
8598
+ "Sending 0conf splice_locked txid {} to our peer for channel {}",
8599
+ splice_txid,
8600
+ &self.context.channel_id
8601
+ );
8602
+ }
8581
8603
} else {
8582
8604
debug_assert!(false);
8583
8605
}
@@ -8587,11 +8609,20 @@ where
8587
8609
self.context.channel_state =
8588
8610
ChannelState::AwaitingChannelReady(AwaitingChannelReadyFlags::new());
8589
8611
}
8612
+
8613
+ splice_locked
8590
8614
}
8591
8615
8592
- pub fn funding_transaction_signed(
8593
- &mut self, funding_txid_signed: Txid, witnesses: Vec<Witness>,
8594
- ) -> Result<(Option<msgs::TxSignatures>, Option<Transaction>), APIError> {
8616
+ pub fn funding_transaction_signed<L: Deref>(
8617
+ &mut self, funding_txid_signed: Txid, witnesses: Vec<Witness>, best_block_height: u32,
8618
+ logger: &L,
8619
+ ) -> Result<
8620
+ (Option<msgs::TxSignatures>, Option<msgs::SpliceLocked>, Option<Transaction>),
8621
+ APIError,
8622
+ >
8623
+ where
8624
+ L::Target: Logger,
8625
+ {
8595
8626
let signing_session =
8596
8627
if let Some(signing_session) = self.context.interactive_tx_signing_session.as_mut() {
8597
8628
if let Some(pending_splice) = self.pending_splice.as_ref() {
@@ -8606,9 +8637,9 @@ where
8606
8637
}
8607
8638
8608
8639
if signing_session.holder_tx_signatures().is_some() {
8609
- // Our `tx_signatures` either should've been the first time we processed them,
8610
- // or we're waiting for our counterparty to send theirs first.
8611
- return Ok((None, None));
8640
+ // Our `tx_signatures` either should've been sent the first time we processed
8641
+ // them, or we're waiting for our counterparty to send theirs first.
8642
+ return Ok((None, None, None ));
8612
8643
}
8613
8644
8614
8645
signing_session
@@ -8653,17 +8684,31 @@ where
8653
8684
.provide_holder_witnesses(tx_signatures, &self.context.secp_ctx)
8654
8685
.map_err(|err| APIError::APIMisuseError { err })?;
8655
8686
8656
- if let Some(funding_tx) = funding_tx_opt.clone() {
8657
- debug_assert!(tx_signatures_opt.is_some());
8658
- self.on_tx_signatures_exchange(funding_tx);
8687
+ let logger = WithChannelContext::from(logger, &self.context, None);
8688
+ if tx_signatures_opt.is_some() {
8689
+ log_info!(
8690
+ logger,
8691
+ "Sending tx_signatures for interactive funding transaction {funding_txid_signed}"
8692
+ );
8659
8693
}
8660
8694
8661
- Ok((tx_signatures_opt, funding_tx_opt))
8695
+ let splice_locked_opt = funding_tx_opt.clone().and_then(|funding_tx| {
8696
+ debug_assert!(tx_signatures_opt.is_some());
8697
+ self.on_tx_signatures_exchange(funding_tx, best_block_height, &logger)
8698
+ });
8699
+
8700
+ Ok((tx_signatures_opt, splice_locked_opt, funding_tx_opt))
8662
8701
}
8663
8702
8664
- pub fn tx_signatures(
8665
- &mut self, msg: &msgs::TxSignatures,
8666
- ) -> Result<(Option<msgs::TxSignatures>, Option<Transaction>), ChannelError> {
8703
+ pub fn tx_signatures<L: Deref>(
8704
+ &mut self, msg: &msgs::TxSignatures, best_block_height: u32, logger: &L,
8705
+ ) -> Result<
8706
+ (Option<msgs::TxSignatures>, Option<msgs::SpliceLocked>, Option<Transaction>),
8707
+ ChannelError,
8708
+ >
8709
+ where
8710
+ L::Target: Logger,
8711
+ {
8667
8712
let signing_session = if let Some(signing_session) =
8668
8713
self.context.interactive_tx_signing_session.as_mut()
8669
8714
{
@@ -8709,11 +8754,18 @@ where
8709
8754
let (holder_tx_signatures_opt, funding_tx_opt) =
8710
8755
signing_session.received_tx_signatures(msg).map_err(|msg| ChannelError::Warn(msg))?;
8711
8756
8712
- if let Some(funding_tx) = funding_tx_opt.clone() {
8713
- self.on_tx_signatures_exchange(funding_tx);
8714
- }
8757
+ let logger = WithChannelContext::from(logger, &self.context, None);
8758
+ log_info!(
8759
+ logger,
8760
+ "Received tx_signatures for interactive funding transaction {}",
8761
+ msg.tx_hash
8762
+ );
8763
+
8764
+ let splice_locked_opt = funding_tx_opt.clone().and_then(|funding_tx| {
8765
+ self.on_tx_signatures_exchange(funding_tx, best_block_height, &logger)
8766
+ });
8715
8767
8716
- Ok((holder_tx_signatures_opt, funding_tx_opt))
8768
+ Ok((holder_tx_signatures_opt, splice_locked_opt, funding_tx_opt))
8717
8769
}
8718
8770
8719
8771
/// Queues up an outbound update fee by placing it in the holding cell. You should call
@@ -11019,7 +11071,11 @@ where
11019
11071
confirmed_funding_index,
11020
11072
height,
11021
11073
) {
11022
- log_info!(logger, "Sending a splice_locked to our peer for channel {}", &self.context.channel_id);
11074
+ log_info!(
11075
+ logger, "Sending splice_locked txid {} to our peer for channel {}",
11076
+ splice_locked.splice_txid,
11077
+ &self.context.channel_id
11078
+ );
11023
11079
11024
11080
let (funding_txo, monitor_update, announcement_sigs, discarded_funding) = chain_node_signer
11025
11081
.and_then(|(chain_hash, node_signer, user_config)| {
0 commit comments