Skip to content

Commit 8ac6f24

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 f0890ed commit 8ac6f24

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
@@ -8813,27 +8813,56 @@ where
88138813
msg.your_last_funding_locked_txid
88148814
.is_none()
88158815
.then(|| ())
8816+
// The sending node:
8817+
// - if `my_current_funding_locked` is included:
8818+
// - if `announce_channel` is set for this channel:
8819+
// - if it has not received `announcement_signatures` for that transaction:
8820+
// - MUST retransmit `channel_ready` or `splice_locked` after exchanging `channel_reestablish`.
8821+
.or_else(|| {
8822+
self.maybe_get_my_current_funding_locked()
8823+
.filter(|funding| !funding.is_splice())
8824+
.filter(|_| self.context.config.announce_for_forwarding)
8825+
.filter(|_| self.context.announcement_sigs.is_none())
8826+
.map(|_| ())
8827+
})
88168828
.and_then(|_| self.get_channel_ready(logger))
88178829
} else { None };
88188830

8819-
// A receiving node:
8820-
// - if `your_last_funding_locked` is set and it does not match the most recent
8821-
// `splice_locked` it has sent:
8822-
// - MUST retransmit `splice_locked`.
88238831
let sent_splice_txid = self
88248832
.maybe_get_my_current_funding_locked()
88258833
.filter(|funding| funding.is_splice())
88268834
.map(|funding| {
88278835
funding.get_funding_txid().expect("Splice funding_txid should always be set")
88288836
});
8829-
let splice_locked = msg.your_last_funding_locked_txid.and_then(|last_funding_txid| {
8830-
sent_splice_txid
8831-
.filter(|sent_splice_txid| last_funding_txid != *sent_splice_txid)
8832-
.map(|splice_txid| msgs::SpliceLocked {
8833-
channel_id: self.context.channel_id,
8834-
splice_txid,
8835-
})
8836-
});
8837+
let splice_locked = msg
8838+
// A receiving node:
8839+
// - if `your_last_funding_locked` is set and it does not match the most recent
8840+
// `splice_locked` it has sent:
8841+
// - MUST retransmit `splice_locked`.
8842+
.your_last_funding_locked_txid
8843+
.and_then(|last_funding_txid| {
8844+
sent_splice_txid.filter(|sent_splice_txid| last_funding_txid != *sent_splice_txid)
8845+
})
8846+
// The sending node:
8847+
// - if `my_current_funding_locked` is included:
8848+
// - if `announce_channel` is set for this channel:
8849+
// - if it has not received `announcement_signatures` for that transaction:
8850+
// - MUST retransmit `channel_ready` or `splice_locked` after exchanging `channel_reestablish`.
8851+
.or_else(|| {
8852+
sent_splice_txid
8853+
.filter(|_| self.context.config.announce_for_forwarding)
8854+
.filter(|sent_splice_txid| {
8855+
if self.funding.get_funding_txid() == Some(*sent_splice_txid) {
8856+
self.context.announcement_sigs.is_none()
8857+
} else {
8858+
true
8859+
}
8860+
})
8861+
})
8862+
.map(|splice_txid| msgs::SpliceLocked {
8863+
channel_id: self.context.channel_id,
8864+
splice_txid,
8865+
});
88378866

88388867
let mut commitment_update = None;
88398868
let mut tx_signatures = None;

0 commit comments

Comments
 (0)