@@ -1220,6 +1220,7 @@ pub(super) struct ReestablishResponses {
12201220 pub shutdown_msg: Option<msgs::Shutdown>,
12211221 pub tx_signatures: Option<msgs::TxSignatures>,
12221222 pub tx_abort: Option<msgs::TxAbort>,
1223+ pub inferred_splice_locked: Option<msgs::SpliceLocked>,
12231224}
12241225
12251226/// The first message we send to our peer after connection
@@ -9328,6 +9329,7 @@ where
93289329 shutdown_msg, announcement_sigs,
93299330 tx_signatures,
93309331 tx_abort: None,
9332+ inferred_splice_locked: None,
93319333 });
93329334 }
93339335
@@ -9340,6 +9342,7 @@ where
93409342 shutdown_msg, announcement_sigs,
93419343 tx_signatures,
93429344 tx_abort,
9345+ inferred_splice_locked: None,
93439346 });
93449347 }
93459348
@@ -9375,6 +9378,30 @@ where
93759378 self.get_channel_ready(logger)
93769379 } else { None };
93779380
9381+ // A receiving node:
9382+ // - if splice transactions are pending and `my_current_funding_locked` matches one of
9383+ // those splice transactions, for which it hasn't received `splice_locked` yet:
9384+ // - MUST process `my_current_funding_locked` as if it was receiving `splice_locked`
9385+ // for this `txid`.
9386+ #[cfg(splicing)]
9387+ let inferred_splice_locked = msg.my_current_funding_locked.as_ref().and_then(|funding_locked| {
9388+ self.pending_funding
9389+ .iter()
9390+ .find(|funding| funding.get_funding_txid() == Some(funding_locked.txid))
9391+ .and_then(|_| {
9392+ self.pending_splice.as_ref().and_then(|pending_splice| {
9393+ (Some(funding_locked.txid) != pending_splice.received_funding_txid)
9394+ .then(|| funding_locked.txid)
9395+ })
9396+ })
9397+ .map(|splice_txid| msgs::SpliceLocked {
9398+ channel_id: self.context.channel_id,
9399+ splice_txid,
9400+ })
9401+ });
9402+ #[cfg(not(splicing))]
9403+ let inferred_splice_locked = None;
9404+
93789405 if msg.next_local_commitment_number == next_counterparty_commitment_number {
93799406 if required_revoke.is_some() || self.context.signer_pending_revoke_and_ack {
93809407 log_debug!(logger, "Reconnected channel {} with only lost outbound RAA", &self.context.channel_id());
@@ -9392,6 +9419,7 @@ where
93929419 commitment_order: self.context.resend_order.clone(),
93939420 tx_signatures,
93949421 tx_abort,
9422+ inferred_splice_locked,
93959423 })
93969424 } else if msg.next_local_commitment_number == next_counterparty_commitment_number - 1 {
93979425 debug_assert!(commitment_update.is_none());
@@ -9416,6 +9444,7 @@ where
94169444 commitment_order: self.context.resend_order.clone(),
94179445 tx_signatures: None,
94189446 tx_abort,
9447+ inferred_splice_locked,
94199448 })
94209449 } else {
94219450 let commitment_update = if self.context.resend_order == RAACommitmentOrder::RevokeAndACKFirst
@@ -9442,6 +9471,7 @@ where
94429471 commitment_order: self.context.resend_order.clone(),
94439472 tx_signatures: None,
94449473 tx_abort,
9474+ inferred_splice_locked,
94459475 })
94469476 }
94479477 } else if msg.next_local_commitment_number < next_counterparty_commitment_number {
0 commit comments