Skip to content

Commit 719ade4

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 86b4391 commit 719ade4

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::RetransmitFlag::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
@@ -954,6 +954,11 @@ impl FundingLocked {
954954
pub fn retransmit(&mut self, flag: RetransmitFlag) {
955955
self.retransmit_flags |= 1 << flag as u8;
956956
}
957+
958+
/// Returns whether the message corresponding to `flag` should be retransmitted.
959+
pub fn should_retransmit(&self, flag: RetransmitFlag) -> bool {
960+
self.retransmit_flags & (1 << flag as u8) != 0
961+
}
957962
}
958963

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

0 commit comments

Comments
 (0)