Skip to content

Commit b647280

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 71ffb50 commit b647280

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

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

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

0 commit comments

Comments
 (0)