]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Merge pull request #2731 from shaavan/issue2711
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Thu, 4 Apr 2024 08:12:36 +0000 (08:12 +0000)
committerGitHub <noreply@github.com>
Thu, 4 Apr 2024 08:12:36 +0000 (08:12 +0000)
Delay broadcasting Channel Updates until connected to peers

1  2 
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_test_utils.rs
lightning/src/ln/functional_tests.rs

index b3581fd6920ad503ea835e95fb9024ea0a08623d,09a17e42bfa599141254d58bd411ecdbbaad0b15..11d0b299efef3a35d0d8872d5a016ad807498838
@@@ -7599,14 -7304,10 +7601,15 @@@ wher
                                                                let pending_msg_events = &mut peer_state.pending_msg_events;
                                                                if let hash_map::Entry::Occupied(chan_phase_entry) = peer_state.channel_by_id.entry(channel_id) {
                                                                        if let ChannelPhase::Funded(mut chan) = remove_channel_phase!(self, chan_phase_entry) {
 -                                                                              failed_channels.push(chan.context.force_shutdown(false, ClosureReason::HolderForceClosed));
 +                                                                              let reason = if let MonitorEvent::HolderForceClosedWithInfo { reason, .. } = monitor_event {
 +                                                                                      reason
 +                                                                              } else {
 +                                                                                      ClosureReason::HolderForceClosed
 +                                                                              };
 +                                                                              failed_channels.push(chan.context.force_shutdown(false, reason.clone()));
                                                                                if let Ok(update) = self.get_channel_update_for_broadcast(&chan) {
-                                                                                       pending_msg_events.push(events::MessageSendEvent::BroadcastChannelUpdate {
+                                                                                       let mut pending_broadcast_messages = self.pending_broadcast_messages.lock().unwrap();
+                                                                                       pending_broadcast_messages.push(events::MessageSendEvent::BroadcastChannelUpdate {
                                                                                                msg: update
                                                                                        });
                                                                                }
Simple merge