Skip to content

Commit 87e8a63

Browse files
committed
channeld.c: update logic for retransmitting channel_ready
Extracted logic from if clause to variable for readability, and add extra checks to make sure a splice is active
1 parent 7fb9a7e commit 87e8a63

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

channeld/channeld.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5936,6 +5936,17 @@ static void peer_reconnect(struct peer *peer,
59365936
"next_funding_txid not recognized.");
59375937
}
59385938

5939+
/* "none of those channel_reestablish messages contain
5940+
* my_current_funding_locked or next_funding for a splice transaction" */
5941+
bool is_splice_active = local_next_funding
5942+
|| peer->splice_state->locked_ready[LOCAL]
5943+
|| remote_next_funding
5944+
|| (recv_tlvs
5945+
&& recv_tlvs->my_current_funding_locked
5946+
&& !bitcoin_txid_eq(
5947+
&recv_tlvs->my_current_funding_locked->my_current_funding_locked_txid,
5948+
&peer->channel->funding.txid));
5949+
59395950
/* BOLT #2:
59405951
*
59415952
* - if `next_commitment_number` is 1 in both the
@@ -5950,10 +5961,7 @@ static void peer_reconnect(struct peer *peer,
59505961
if (peer->channel_ready[LOCAL]
59515962
&& peer->next_index[LOCAL] == 1
59525963
&& next_commitment_number == 1
5953-
&& !local_next_funding
5954-
&& !(send_tlvs && send_tlvs->my_current_funding_locked)
5955-
&& !remote_next_funding
5956-
&& !(recv_tlvs && recv_tlvs->my_current_funding_locked)) {
5964+
&& !is_splice_active) {
59575965
struct tlv_channel_ready_tlvs *tlvs = tlv_channel_ready_tlvs_new(tmpctx);
59585966

59595967
tlvs->short_channel_id = &peer->local_alias;

0 commit comments

Comments
 (0)