Skip to content

Commit d78b368

Browse files
committed
Resend splice_locked from channel_reestablish tlv your_last_funding_locked
1 parent 399826c commit d78b368

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

channeld/channeld.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5683,6 +5683,7 @@ static void peer_reconnect(struct peer *peer,
56835683
}
56845684
}
56855685

5686+
56865687
/* Re-send `splice_locked` if an inflight is locked */
56875688
for (size_t i = 0; i < tal_count(peer->splice_state->inflights); i++) {
56885689
struct inflight *itr = peer->splice_state->inflights[i];
@@ -5694,7 +5695,28 @@ static void peer_reconnect(struct peer *peer,
56945695
&peer->channel_id,
56955696
&itr->outpoint.txid)));
56965697
peer->splice_state->locked_ready[LOCAL] = true;
5697-
}
5698+
}
5699+
5700+
// A Receiving node:
5701+
// - if your_last_funding_locked is not set, or if it does not match the most recent splice_locked it has sent:
5702+
// - MUST retransmit splice_locked.
5703+
struct bitcoin_txid *your_last_funding_locked_txid = (recv_tlvs ? recv_tlvs->your_last_funding_locked_txid : NULL);
5704+
struct bitcoin_txid *my_current_funding_locked_txid = (send_tlvs ? send_tlvs->my_current_funding_locked_txid : NULL);
5705+
if (!bitcoin_txid_eq(my_current_funding_locked_txid, your_last_funding_locked_txid)) {
5706+
status_info("your_last_funding_locked from peer does not match the most recent splice_locked we sent;"
5707+
" resending splice_lock; %s != %s",
5708+
(your_last_funding_locked_txid ? fmt_bitcoin_txid(tmpctx, your_last_funding_locked_txid) : "NULL"),
5709+
fmt_bitcoin_txid(tmpctx, my_current_funding_locked_txid));
5710+
peer_write(peer->pps,
5711+
take(towire_splice_locked(NULL,
5712+
&peer->channel_id,
5713+
&peer->channel->funding.txid)));
5714+
}
5715+
5716+
// A Receiving node:
5717+
// - if my_current_funding_locked does not match the most recent splice_locked it has received:
5718+
// - 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.
5719+
//struct bitcoin_txid *my_current_funding_locked_txid = (recv_tlvs ? recv_tlvs->my_current_funding_locked_txid : NULL);
56985720

56995721
/* BOLT #2:
57005722
*

0 commit comments

Comments
 (0)