@@ -13004,12 +13004,16 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1300413004 msg,
1300513005 &self.config.read().unwrap(),
1300613006 );
13007- peer_state.pending_msg_events.push(MessageSendEvent::BroadcastChannelAnnouncement {
13008- msg: try_channel_entry!(self, peer_state, res, chan_entry),
13009- // Note that announcement_signatures fails if the channel cannot be announced,
13010- // so get_channel_update_for_broadcast will never fail by the time we get here.
13011- update_msg: Some(self.get_channel_update_for_broadcast(chan).unwrap().0),
13012- });
13007+ let announcement_msg = try_channel_entry!(self, peer_state, res, chan_entry);
13008+ // Note that announcement_signatures fails if the channel cannot be announced,
13009+ // so get_channel_update_for_broadcast will never fail by the time we get here.
13010+ let update_msg = self.get_channel_update_for_broadcast(chan).unwrap().0;
13011+ self.pending_broadcast_messages.lock().unwrap().push(
13012+ MessageSendEvent::BroadcastChannelAnnouncement {
13013+ msg: announcement_msg,
13014+ update_msg: Some(update_msg),
13015+ },
13016+ );
1301313017 } else {
1301413018 return try_channel_entry!(self, peer_state, Err(ChannelError::close(
1301513019 "Got an announcement_signatures message for an unfunded channel!".into())), chan_entry);
@@ -15485,11 +15489,14 @@ impl<
1548515489 &MessageSendEvent::HandleError { .. } => false,
1548615490 // Gossip
1548715491 &MessageSendEvent::SendChannelAnnouncement { .. } => false,
15488- &MessageSendEvent::BroadcastChannelAnnouncement { .. } => true,
15489- // [`ChannelManager::pending_broadcast_events`] holds the [`BroadcastChannelUpdate`]
15490- // This check here is to ensure exhaustivity.
15492+ // [`ChannelManager::pending_broadcast_messages`] holds broadcast events,
15493+ // not per-peer queues.
15494+ &MessageSendEvent::BroadcastChannelAnnouncement { .. } => {
15495+ debug_assert!(false, "BroadcastChannelAnnouncement should be in pending_broadcast_messages");
15496+ false
15497+ },
1549115498 &MessageSendEvent::BroadcastChannelUpdate { .. } => {
15492- debug_assert!(false, "This event shouldn't have been here ");
15499+ debug_assert!(false, "BroadcastChannelUpdate should be in pending_broadcast_messages ");
1549315500 false
1549415501 },
1549515502 &MessageSendEvent::BroadcastNodeAnnouncement { .. } => true,
@@ -15687,10 +15694,6 @@ impl<
1568715694 /// the chunks of `MessageSendEvent`s for different peers is random. I.e. if the array contains
1568815695 /// `MessageSendEvent`s for both `node_a` and `node_b`, the `MessageSendEvent`s for `node_a`
1568915696 /// will randomly be placed first or last in the returned array.
15690- ///
15691- /// Note that even though `BroadcastChannelAnnouncement` and `BroadcastChannelUpdate`
15692- /// `MessageSendEvent`s are intended to be broadcasted to all peers, they will be placed among
15693- /// the `MessageSendEvent`s to the specific peer they were generated under.
1569415697 fn get_and_clear_pending_msg_events(&self) -> Vec<MessageSendEvent> {
1569515698 let events = RefCell::new(Vec::new());
1569615699 PersistenceNotifierGuard::optionally_notify(self, || {
@@ -16143,14 +16146,16 @@ impl<
1614316146 if let Some(announcement) = funded_channel.get_signed_channel_announcement(
1614416147 &self.node_signer, self.chain_hash, height, &self.config.read().unwrap(),
1614516148 ) {
16146- pending_msg_events.push(MessageSendEvent::BroadcastChannelAnnouncement {
16147- msg: announcement,
16148- // Note that get_signed_channel_announcement fails
16149- // if the channel cannot be announced, so
16150- // get_channel_update_for_broadcast will never fail
16151- // by the time we get here.
16152- update_msg: Some(self.get_channel_update_for_broadcast(funded_channel).unwrap().0),
16153- });
16149+ self.pending_broadcast_messages.lock().unwrap().push(
16150+ MessageSendEvent::BroadcastChannelAnnouncement {
16151+ msg: announcement,
16152+ // Note that get_signed_channel_announcement
16153+ // fails if the channel cannot be announced, so
16154+ // get_channel_update_for_broadcast will never
16155+ // fail by the time we get here.
16156+ update_msg: Some(self.get_channel_update_for_broadcast(funded_channel).unwrap().0),
16157+ },
16158+ );
1615416159 }
1615516160 }
1615616161 }
0 commit comments