Skip to content

Commit 741b740

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 accaa9f commit 741b740

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
@@ -8409,27 +8409,56 @@ where
84098409
msg.your_last_funding_locked_txid
84108410
.is_none()
84118411
.then(|| ())
8412+
// The sending node:
8413+
// - if `my_current_funding_locked` is included:
8414+
// - if `announce_channel` is set for this channel:
8415+
// - if it has not received `announcement_signatures` for that transaction:
8416+
// - MUST retransmit `channel_ready` or `splice_locked` after exchanging `channel_reestablish`.
8417+
.or_else(|| {
8418+
self.maybe_get_my_current_funding_locked(their_features)
8419+
.filter(|funding| !funding.is_splice())
8420+
.filter(|_| self.context.config.announce_for_forwarding)
8421+
.filter(|_| self.context.announcement_sigs.is_none())
8422+
.map(|_| ())
8423+
})
84128424
.and_then(|_| self.get_channel_ready(logger))
84138425
} else { None };
84148426

8415-
// A receiving node:
8416-
// - if `your_last_funding_locked` is set and it does not match the most recent
8417-
// `splice_locked` it has sent:
8418-
// - MUST retransmit `splice_locked`.
84198427
let sent_splice_txid = self
84208428
.maybe_get_my_current_funding_locked(their_features)
84218429
.filter(|funding| funding.is_splice())
84228430
.map(|funding| {
84238431
funding.get_funding_txid().expect("Splice funding_txid should always be set")
84248432
});
8425-
let splice_locked = msg.your_last_funding_locked_txid.and_then(|last_funding_txid| {
8426-
sent_splice_txid
8427-
.filter(|sent_splice_txid| last_funding_txid != *sent_splice_txid)
8428-
.map(|splice_txid| msgs::SpliceLocked {
8429-
channel_id: self.context.channel_id,
8430-
splice_txid,
8431-
})
8432-
});
8433+
let splice_locked = msg
8434+
// A receiving node:
8435+
// - if `your_last_funding_locked` is set and it does not match the most recent
8436+
// `splice_locked` it has sent:
8437+
// - MUST retransmit `splice_locked`.
8438+
.your_last_funding_locked_txid
8439+
.and_then(|last_funding_txid| {
8440+
sent_splice_txid.filter(|sent_splice_txid| last_funding_txid != *sent_splice_txid)
8441+
})
8442+
// The sending node:
8443+
// - if `my_current_funding_locked` is included:
8444+
// - if `announce_channel` is set for this channel:
8445+
// - if it has not received `announcement_signatures` for that transaction:
8446+
// - MUST retransmit `channel_ready` or `splice_locked` after exchanging `channel_reestablish`.
8447+
.or_else(|| {
8448+
sent_splice_txid
8449+
.filter(|_| self.context.config.announce_for_forwarding)
8450+
.filter(|sent_splice_txid| {
8451+
if self.funding.get_funding_txid() == Some(*sent_splice_txid) {
8452+
self.context.announcement_sigs.is_none()
8453+
} else {
8454+
true
8455+
}
8456+
})
8457+
})
8458+
.map(|splice_txid| msgs::SpliceLocked {
8459+
channel_id: self.context.channel_id,
8460+
splice_txid,
8461+
});
84338462

84348463
let mut commitment_update = None;
84358464
let mut tx_signatures = None;

0 commit comments

Comments
 (0)