File tree Expand file tree Collapse file tree 2 files changed +34
-4
lines changed Expand file tree Collapse file tree 2 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -11103,7 +11103,25 @@ where
1110311103 .or_else(|| {
1110411104 self.is_our_channel_ready().then(|| self.funding.get_funding_txid()).flatten()
1110511105 })
11106- .map(|txid| msgs::FundingLocked { txid, retransmit_flags: 0 })
11106+ .map(|txid| {
11107+ let mut funding_locked = msgs::FundingLocked { txid, retransmit_flags: 0 };
11108+
11109+ // - if `my_current_funding_locked` is included:
11110+ // - if `announce_channel` is set for this channel:
11111+ // - if it has not received `announcement_signatures` for that transaction:
11112+ // - MUST set the `announcement_signatures` bit to `1` in `retransmit_flags`.
11113+ // - otherwise:
11114+ // - MUST set the `announcement_signatures` bit to `0` in `retransmit_flags`.
11115+ if self.context.config.announce_for_forwarding {
11116+ if self.funding.get_funding_txid() != Some(txid)
11117+ || self.context.announcement_sigs.is_none()
11118+ {
11119+ funding_locked.retransmit(msgs::FundingLockedFlags::AnnouncementSignatures);
11120+ }
11121+ }
11122+
11123+ funding_locked
11124+ })
1110711125 }
1110811126
1110911127 #[cfg(not(splicing))]
Original file line number Diff line number Diff line change @@ -976,12 +976,24 @@ pub struct FundingLocked {
976976
977977 /// A bitfield indicating which messages should be retransmitted by the receiving node.
978978 ///
979- /// | Bit Position | Name |
980- /// | ------------- | --------------------------|
981- /// | 0 | `announcement_signatures` |
979+ /// See [`FundingLockedFlags`] for details.
982980 pub retransmit_flags : u8 ,
983981}
984982
983+ impl FundingLocked {
984+ /// Sets the bit in `retransmit_flags` for retransmitting the message corresponding to `flag`.
985+ pub fn retransmit ( & mut self , flag : FundingLockedFlags ) {
986+ self . retransmit_flags |= 1 << flag as u8 ;
987+ }
988+ }
989+
990+ /// Bit positions used in [`FundingLocked::retransmit_flags`] for requesting message retransmission.
991+ #[ repr( u8 ) ]
992+ pub enum FundingLockedFlags {
993+ /// Retransmit `announcement_signatures`.
994+ AnnouncementSignatures = 0 ,
995+ }
996+
985997/// An [`announcement_signatures`] message to be sent to or received from a peer.
986998///
987999/// [`announcement_signatures`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-announcement_signatures-message
You can’t perform that action at this time.
0 commit comments