Skip to content

Commit 1b52eb6

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 6fb15b8 commit 1b52eb6

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
@@ -8818,27 +8818,56 @@ where
88188818
msg.your_last_funding_locked_txid
88198819
.is_none()
88208820
.then(|| ())
8821+
// The sending node:
8822+
// - if `my_current_funding_locked` is included:
8823+
// - if `announce_channel` is set for this channel:
8824+
// - if it has not received `announcement_signatures` for that transaction:
8825+
// - MUST retransmit `channel_ready` or `splice_locked` after exchanging `channel_reestablish`.
8826+
.or_else(|| {
8827+
self.maybe_get_my_current_funding_locked()
8828+
.filter(|funding| !funding.is_splice())
8829+
.filter(|_| self.context.config.announce_for_forwarding)
8830+
.filter(|_| self.context.announcement_sigs.is_none())
8831+
.map(|_| ())
8832+
})
88218833
.and_then(|_| self.get_channel_ready(logger))
88228834
} else { None };
88238835

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

88438872
let mut commitment_update = None;
88448873
let mut tx_signatures = None;

0 commit comments

Comments
 (0)