Skip to content

Commit a339adf

Browse files
committed
Retransmit channel_ready / splice_locked awaiting announcement_sigs
The splicing spec updates channel_establishment logic to retransmit channel_ready or splice_locked for announced channels. Specifically: - if `my_current_funding_locked` is included: - if `announce_channel` is set for this channel: - if it has not received `announcement_signatures` for that transaction: - MUST retransmit `channel_ready` or `splice_locked` after exchanging `channel_reestablish`.
1 parent db7926c commit a339adf

File tree

1 file changed

+41
-12
lines changed

1 file changed

+41
-12
lines changed

lightning/src/ln/channel.rs

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8449,27 +8449,56 @@ where
84498449
msg.your_last_funding_locked_txid
84508450
.is_none()
84518451
.then(|| ())
8452+
// The sending node:
8453+
// - if `my_current_funding_locked` is included:
8454+
// - if `announce_channel` is set for this channel:
8455+
// - if it has not received `announcement_signatures` for that transaction:
8456+
// - MUST retransmit `channel_ready` or `splice_locked` after exchanging `channel_reestablish`.
8457+
.or_else(|| {
8458+
self.maybe_get_my_current_funding_locked(features)
8459+
.filter(|funding| !funding.is_splice())
8460+
.filter(|_| self.context.config.announce_for_forwarding)
8461+
.filter(|_| self.context.announcement_sigs.is_none())
8462+
.map(|_| ())
8463+
})
84528464
.and_then(|_| self.get_channel_ready(logger))
84538465
} else { None };
84548466

8455-
// A receiving node:
8456-
// - if `your_last_funding_locked` is set and it does not match the most recent
8457-
// `splice_locked` it has sent:
8458-
// - MUST retransmit `splice_locked`.
84598467
let sent_splice_txid = self
84608468
.maybe_get_my_current_funding_locked(features)
84618469
.filter(|funding| funding.is_splice())
84628470
.map(|funding| {
84638471
funding.get_funding_txid().expect("Splice funding_txid should always be set")
84648472
});
8465-
let splice_locked = msg.your_last_funding_locked_txid.and_then(|last_funding_txid| {
8466-
sent_splice_txid
8467-
.filter(|sent_splice_txid| last_funding_txid != *sent_splice_txid)
8468-
.map(|splice_txid| msgs::SpliceLocked {
8469-
channel_id: self.context.channel_id,
8470-
splice_txid,
8471-
})
8472-
});
8473+
let splice_locked = msg
8474+
// A receiving node:
8475+
// - if `your_last_funding_locked` is set and it does not match the most recent
8476+
// `splice_locked` it has sent:
8477+
// - MUST retransmit `splice_locked`.
8478+
.your_last_funding_locked_txid
8479+
.and_then(|last_funding_txid| {
8480+
sent_splice_txid.filter(|sent_splice_txid| last_funding_txid != *sent_splice_txid)
8481+
})
8482+
// The sending node:
8483+
// - if `my_current_funding_locked` is included:
8484+
// - if `announce_channel` is set for this channel:
8485+
// - if it has not received `announcement_signatures` for that transaction:
8486+
// - MUST retransmit `channel_ready` or `splice_locked` after exchanging `channel_reestablish`.
8487+
.or_else(|| {
8488+
sent_splice_txid
8489+
.filter(|_| self.context.config.announce_for_forwarding)
8490+
.filter(|sent_splice_txid| {
8491+
if self.funding.get_funding_txid() == Some(*sent_splice_txid) {
8492+
self.context.announcement_sigs.is_none()
8493+
} else {
8494+
true
8495+
}
8496+
})
8497+
})
8498+
.map(|splice_txid| msgs::SpliceLocked {
8499+
channel_id: self.context.channel_id,
8500+
splice_txid,
8501+
});
84738502

84748503
let mut commitment_update = None;
84758504
let mut tx_signatures = None;

0 commit comments

Comments
 (0)