Skip to content

Commit 1bc9b8a

Browse files
jkczyzAnyitechs
authored andcommitted
Retransmit announcement_signatures if requested
The previous commit allowed requesting retransmission of announcement_signatures during channel reestablishment. This commit handles such requests.
1 parent 6dbb7d8 commit 1bc9b8a

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
@@ -9210,6 +9210,20 @@ where
92109210

92119211
let shutdown_msg = self.get_outbound_shutdown();
92129212

9213+
// A receiving node:
9214+
// - if `my_current_funding_locked` is included with the `announcement_signatures` bit
9215+
// set in the `retransmit_flags`:
9216+
// - if `announce_channel` is set for this channel and the receiving node is ready
9217+
// to send `announcement_signatures` for the corresponding splice transaction:
9218+
// - MUST retransmit `announcement_signatures`.
9219+
if let Some(funding_locked) = &msg.my_current_funding_locked {
9220+
if funding_locked.should_retransmit(msgs::FundingLockedFlags::AnnouncementSignatures) {
9221+
if self.funding.get_funding_txid() == Some(funding_locked.txid) {
9222+
self.context.announcement_sigs_state = AnnouncementSigsState::NotSent;
9223+
}
9224+
}
9225+
}
9226+
92139227
let announcement_sigs = self.get_announcement_sigs(node_signer, chain_hash, user_config, best_block.height, logger);
92149228

92159229
let mut commitment_update = None;

lightning/src/ln/msgs.rs

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

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

0 commit comments

Comments
 (0)