@@ -5683,6 +5683,25 @@ static void peer_reconnect(struct peer *peer,
56835683 }
56845684 }
56855685
5686+ status_debug ("Receiving channel_reestablish with"
5687+ " next_funding_tx_id: %s,"
5688+ " your_last_funding_locked: %s,"
5689+ " my_current_funding_locked: %s,"
5690+ " next_local_commit_number: %" PRIu64 "," ,
5691+ recv_tlvs && recv_tlvs -> next_funding
5692+ ? fmt_bitcoin_txid (tmpctx ,
5693+ recv_tlvs -> next_funding )
5694+ : "NULL" ,
5695+ recv_tlvs && recv_tlvs -> your_last_funding_locked_txid
5696+ ? fmt_bitcoin_txid (tmpctx ,
5697+ recv_tlvs -> your_last_funding_locked_txid )
5698+ : "NULL" ,
5699+ recv_tlvs && recv_tlvs -> my_current_funding_locked_txid
5700+ ? fmt_bitcoin_txid (tmpctx ,
5701+ recv_tlvs -> my_current_funding_locked_txid )
5702+ : "NULL" ,
5703+ next_commitment_number );
5704+
56865705 /* Re-send `splice_locked` if an inflight is locked */
56875706 for (size_t i = 0 ; i < tal_count (peer -> splice_state -> inflights ); i ++ ) {
56885707 struct inflight * itr = peer -> splice_state -> inflights [i ];
@@ -5694,8 +5713,36 @@ static void peer_reconnect(struct peer *peer,
56945713 & peer -> channel_id ,
56955714 & itr -> outpoint .txid )));
56965715 peer -> splice_state -> locked_ready [LOCAL ] = true;
5716+ }
5717+
5718+ // A Receiving node:
5719+ // - if your_last_funding_locked is not set, or if it does not match the most recent splice_locked it has sent:
5720+ // - MUST retransmit splice_locked.
5721+ struct bitcoin_txid * your_last_funding_locked_txid = (recv_tlvs ? recv_tlvs -> your_last_funding_locked_txid : NULL );
5722+ struct bitcoin_txid * my_current_funding_locked_txid = (send_tlvs ? send_tlvs -> my_current_funding_locked_txid : NULL );
5723+ if (!bitcoin_txid_eq (my_current_funding_locked_txid , your_last_funding_locked_txid )) {
5724+ status_info ("your_last_funding_locked from peer does not match the most recent splice_locked we sent;"
5725+ " resending splice_lock; %s != %s" ,
5726+ (your_last_funding_locked_txid ? fmt_bitcoin_txid (tmpctx , your_last_funding_locked_txid ) : "NULL" ),
5727+ fmt_bitcoin_txid (tmpctx , my_current_funding_locked_txid ));
5728+ peer_write (peer -> pps ,
5729+ take (towire_splice_locked (NULL ,
5730+ & peer -> channel_id ,
5731+ & peer -> channel -> funding .txid )));
5732+ }
5733+ else {
5734+ status_debug ("your_last_funding_locked from peer matches the most recent splice_locked we sent;"
5735+ " not resending splice_lock; %s == %s" ,
5736+ (your_last_funding_locked_txid ? fmt_bitcoin_txid (tmpctx , your_last_funding_locked_txid ) : "NULL" ),
5737+ fmt_bitcoin_txid (tmpctx , my_current_funding_locked_txid )
5738+ );
56975739 }
56985740
5741+ // A Receiving node:
5742+ // - if my_current_funding_locked does not match the most recent splice_locked it has received:
5743+ // - MUST process my_current_funding_locked as if it was receiving splice_locked for this txid, and thus discard the previous funding transaction and RBF attempts if it has previously sent its own splice_locked for that txid.
5744+ //struct bitcoin_txid *my_current_funding_locked_txid = (recv_tlvs ? recv_tlvs->my_current_funding_locked_txid : NULL);
5745+
56995746 /* BOLT #2:
57005747 *
57015748 * - if `next_commitment_number` is 1 in both the
0 commit comments