Skip to content

Commit f45f83b

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 c661cb5 commit f45f83b

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
@@ -8421,27 +8421,56 @@ where
84218421
msg.your_last_funding_locked_txid
84228422
.is_none()
84238423
.then(|| ())
8424+
// The sending node:
8425+
// - if `my_current_funding_locked` is included:
8426+
// - if `announce_channel` is set for this channel:
8427+
// - if it has not received `announcement_signatures` for that transaction:
8428+
// - MUST retransmit `channel_ready` or `splice_locked` after exchanging `channel_reestablish`.
8429+
.or_else(|| {
8430+
self.maybe_get_my_current_funding_locked(features)
8431+
.filter(|funding| !funding.is_splice())
8432+
.filter(|_| self.context.config.announce_for_forwarding)
8433+
.filter(|_| self.context.announcement_sigs.is_none())
8434+
.map(|_| ())
8435+
})
84248436
.and_then(|_| self.get_channel_ready(logger))
84258437
} else { None };
84268438

8427-
// A receiving node:
8428-
// - if `your_last_funding_locked` is set and it does not match the most recent
8429-
// `splice_locked` it has sent:
8430-
// - MUST retransmit `splice_locked`.
84318439
let sent_splice_txid = self
84328440
.maybe_get_my_current_funding_locked(features)
84338441
.filter(|funding| funding.is_splice())
84348442
.map(|funding| {
84358443
funding.get_funding_txid().expect("Splice funding_txid should always be set")
84368444
});
8437-
let splice_locked = msg.your_last_funding_locked_txid.and_then(|last_funding_txid| {
8438-
sent_splice_txid
8439-
.filter(|sent_splice_txid| last_funding_txid != *sent_splice_txid)
8440-
.map(|splice_txid| msgs::SpliceLocked {
8441-
channel_id: self.context.channel_id,
8442-
splice_txid,
8443-
})
8444-
});
8445+
let splice_locked = msg
8446+
// A receiving node:
8447+
// - if `your_last_funding_locked` is set and it does not match the most recent
8448+
// `splice_locked` it has sent:
8449+
// - MUST retransmit `splice_locked`.
8450+
.your_last_funding_locked_txid
8451+
.and_then(|last_funding_txid| {
8452+
sent_splice_txid.filter(|sent_splice_txid| last_funding_txid != *sent_splice_txid)
8453+
})
8454+
// The sending node:
8455+
// - if `my_current_funding_locked` is included:
8456+
// - if `announce_channel` is set for this channel:
8457+
// - if it has not received `announcement_signatures` for that transaction:
8458+
// - MUST retransmit `channel_ready` or `splice_locked` after exchanging `channel_reestablish`.
8459+
.or_else(|| {
8460+
sent_splice_txid
8461+
.filter(|_| self.context.config.announce_for_forwarding)
8462+
.filter(|sent_splice_txid| {
8463+
if self.funding.get_funding_txid() == Some(*sent_splice_txid) {
8464+
self.context.announcement_sigs.is_none()
8465+
} else {
8466+
true
8467+
}
8468+
})
8469+
})
8470+
.map(|splice_txid| msgs::SpliceLocked {
8471+
channel_id: self.context.channel_id,
8472+
splice_txid,
8473+
});
84458474

84468475
let mut commitment_update = None;
84478476
let mut tx_signatures = None;

0 commit comments

Comments
 (0)