Skip to content

Commit ff6ead1

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 c562ead commit ff6ead1

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
@@ -5951,6 +5951,17 @@ static void peer_reconnect(struct peer *peer,
59515951
"next_funding_txid not recognized.");
59525952
}
59535953

5954+
/* "none of those channel_reestablish messages contain
5955+
* my_current_funding_locked or next_funding for a splice transaction" */
5956+
bool is_splice_active = local_next_funding
5957+
|| peer->splice_state->locked_ready[LOCAL]
5958+
|| remote_next_funding
5959+
|| (recv_tlvs
5960+
&& recv_tlvs->my_current_funding_locked
5961+
&& !bitcoin_txid_eq(
5962+
&recv_tlvs->my_current_funding_locked->my_current_funding_locked_txid,
5963+
&peer->channel->funding.txid));
5964+
59545965
/* BOLT #2:
59555966
*
59565967
* - if `next_commitment_number` is 1 in both the
@@ -5965,10 +5976,7 @@ static void peer_reconnect(struct peer *peer,
59655976
if (peer->channel_ready[LOCAL]
59665977
&& peer->next_index[LOCAL] == 1
59675978
&& next_commitment_number == 1
5968-
&& !local_next_funding
5969-
&& !(send_tlvs && send_tlvs->my_current_funding_locked)
5970-
&& !remote_next_funding
5971-
&& !(recv_tlvs && recv_tlvs->my_current_funding_locked)) {
5979+
&& !is_splice_active) {
59725980
struct tlv_channel_ready_tlvs *tlvs = tlv_channel_ready_tlvs_new(tmpctx);
59735981

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

0 commit comments

Comments
 (0)