Skip to content

Commit 6e3c071

Browse files
committed
Retransmit announcement_signatures if requested
The previous commit allowed requesting retransmission of announcement_signatures during channel reestablishment. This commit handles such requests.
1 parent abe8dae commit 6e3c071

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

lightning/src/ln/channel.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8718,6 +8718,20 @@ where
87188718

87198719
let shutdown_msg = self.get_outbound_shutdown();
87208720

8721+
// A receiving node:
8722+
// - if `my_current_funding_locked` is included with the `announcement_signatures` bit
8723+
// set in the `retransmit_flags`:
8724+
// - if `announce_channel` is set for this channel and the receiving node is ready
8725+
// to send `announcement_signatures` for the corresponding splice transaction:
8726+
// - MUST retransmit `announcement_signatures`.
8727+
if let Some(funding_locked) = &msg.my_current_funding_locked {
8728+
if funding_locked.should_retransmit(msgs::FundingLockedFlags::AnnouncementSignatures) {
8729+
if self.funding.get_funding_txid() == Some(funding_locked.txid) {
8730+
self.context.announcement_sigs_state = AnnouncementSigsState::NotSent;
8731+
}
8732+
}
8733+
}
8734+
87218735
let announcement_sigs = self.get_announcement_sigs(node_signer, chain_hash, user_config, best_block.height, logger);
87228736

87238737
if matches!(self.context.channel_state, ChannelState::AwaitingChannelReady(_)) {

lightning/src/ln/msgs.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,11 @@ impl FundingLocked {
986986
pub fn retransmit(&mut self, flag: FundingLockedFlags) {
987987
self.retransmit_flags |= 1 << flag as u8;
988988
}
989+
990+
/// Returns whether the message corresponding to `flag` should be retransmitted.
991+
pub fn should_retransmit(&self, flag: FundingLockedFlags) -> bool {
992+
self.retransmit_flags & (1 << flag as u8) != 0
993+
}
989994
}
990995

991996
/// Bit positions used in [`FundingLocked::retransmit_flags`] for requesting message retransmission.

0 commit comments

Comments
 (0)