Skip to content

Commit ff98bbf

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 734452c commit ff98bbf

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
@@ -9173,6 +9173,20 @@ where
91739173

91749174
let shutdown_msg = self.get_outbound_shutdown();
91759175

9176+
// A receiving node:
9177+
// - if `my_current_funding_locked` is included with the `announcement_signatures` bit
9178+
// set in the `retransmit_flags`:
9179+
// - if `announce_channel` is set for this channel and the receiving node is ready
9180+
// to send `announcement_signatures` for the corresponding splice transaction:
9181+
// - MUST retransmit `announcement_signatures`.
9182+
if let Some(funding_locked) = &msg.my_current_funding_locked {
9183+
if funding_locked.should_retransmit(msgs::FundingLockedFlags::AnnouncementSignatures) {
9184+
if self.funding.get_funding_txid() == Some(funding_locked.txid) {
9185+
self.context.announcement_sigs_state = AnnouncementSigsState::NotSent;
9186+
}
9187+
}
9188+
}
9189+
91769190
let announcement_sigs = self.get_announcement_sigs(node_signer, chain_hash, user_config, best_block.height, logger);
91779191

91789192
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)