Skip to content

Commit 9417780

Browse files
committed
Request announcement_signatures retransmission
During channel reestablishment, announcement_signatures may need to be retransmitted. The splicing spec allows doing so without retransmitting splice_locked first, which could normally trigger retransmitting announcement_signatures. Instead, my_current_funding_locked lets the sender request retransmitting it.
1 parent 1a8d319 commit 9417780

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

lightning/src/ln/channel.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10621,7 +10621,21 @@ where
1062110621
.or_else(|| {
1062210622
self.is_our_channel_ready().then(|| self.funding.get_funding_txid()).flatten()
1062310623
})
10624-
.map(|txid| msgs::FundingLocked { txid, retransmit_flags: 0 })
10624+
.map(|txid| {
10625+
let mut funding_locked = msgs::FundingLocked {
10626+
txid,
10627+
retransmit_flags: 0,
10628+
};
10629+
10630+
if self.funding.get_funding_txid() == Some(txid)
10631+
&& self.context.config.announce_for_forwarding
10632+
&& self.context.announcement_sigs.is_none()
10633+
{
10634+
funding_locked.retransmit(msgs::RetransmitFlag::AnnouncementSignatures);
10635+
};
10636+
10637+
funding_locked
10638+
})
1062510639
}
1062610640

1062710641
#[cfg(not(splicing))]

lightning/src/ln/msgs.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -945,12 +945,24 @@ pub struct FundingLocked {
945945

946946
/// A bitfield indicating which messages should be retransmitted by the receiving node.
947947
///
948-
/// | Bit Position | Name |
949-
/// | ------------- | --------------------------|
950-
/// | 0 | `announcement_signatures` |
948+
/// See [`RetransmitFlag`] for details.
951949
pub retransmit_flags: u8,
952950
}
953951

952+
impl FundingLocked {
953+
/// Sets the bit in `retransmit_flags` for retransmitting the message corresponding to `flag`.
954+
pub fn retransmit(&mut self, flag: RetransmitFlag) {
955+
self.retransmit_flags |= 1 << flag as u8;
956+
}
957+
}
958+
959+
/// Bit positions used in [`FundingLocked::retransmit_flags`] for requesting message retransmission.
960+
#[repr(u8)]
961+
pub enum RetransmitFlag {
962+
/// Retransmit `announcement_signatures`.
963+
AnnouncementSignatures = 0,
964+
}
965+
954966
/// An [`announcement_signatures`] message to be sent to or received from a peer.
955967
///
956968
/// [`announcement_signatures`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-announcement_signatures-message

0 commit comments

Comments
 (0)