@@ -9693,12 +9693,46 @@ where
9693
9693
9694
9694
// A node:
9695
9695
// - if `next_commitment_number` is 1 in both the `channel_reestablish` it
9696
- // sent and received:
9696
+ // sent and received, and none of those `channel_reestablish` messages
9697
+ // contain `my_current_funding_locked` or `next_funding` for a splice transaction:
9697
9698
// - MUST retransmit `channel_ready`.
9698
9699
// - otherwise:
9699
9700
// - MUST NOT retransmit `channel_ready`, but MAY send `channel_ready` with
9700
9701
// a different `short_channel_id` `alias` field.
9701
- let channel_ready = if msg.next_local_commitment_number == 1 && INITIAL_COMMITMENT_NUMBER - self.holder_commitment_point.next_transaction_number() == 1 {
9702
+ let both_sides_on_initial_commitment_number = msg.next_local_commitment_number == 1
9703
+ && INITIAL_COMMITMENT_NUMBER - self.holder_commitment_point.next_transaction_number() == 1;
9704
+ let is_resuming_splice_negotiation = {
9705
+ let their_next_funding_txid = msg
9706
+ .next_funding
9707
+ .as_ref()
9708
+ .map(|next_funding| next_funding.txid);
9709
+ let our_next_funding_txid = self
9710
+ .context
9711
+ .interactive_tx_signing_session
9712
+ .as_ref()
9713
+ .map(|signing_session| signing_session.unsigned_tx().compute_txid());
9714
+ self.pending_splice.is_some() && their_next_funding_txid == our_next_funding_txid
9715
+ };
9716
+ let is_resuming_splice_locked = {
9717
+ let their_splice_locked_txid = msg
9718
+ .my_current_funding_locked
9719
+ .as_ref()
9720
+ .map(|funding_locked| funding_locked.txid);
9721
+ let our_splice_locked_txid = self
9722
+ .pending_splice
9723
+ .as_ref()
9724
+ .and_then(|pending_splice| pending_splice.sent_funding_txid)
9725
+ .or(self.funding.get_funding_txid().filter(|_| {
9726
+ self.funding
9727
+ .channel_transaction_parameters
9728
+ .splice_parent_funding_txid
9729
+ .is_some()
9730
+ }));
9731
+ their_splice_locked_txid.is_some() && their_splice_locked_txid == our_splice_locked_txid
9732
+ };
9733
+ let channel_ready = if both_sides_on_initial_commitment_number
9734
+ && !is_resuming_splice_negotiation && !is_resuming_splice_locked
9735
+ {
9702
9736
// We should never have to worry about MonitorUpdateInProgress resending ChannelReady
9703
9737
self.get_channel_ready(logger)
9704
9738
} else { None };
0 commit comments