From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Thu, 4 Apr 2024 08:12:36 +0000 (+0000) Subject: Merge pull request #2731 from shaavan/issue2711 X-Git-Tag: v0.0.123-beta~18 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=1e54dd6a21a645f855c88cc95df85bea68aa23a9;p=rust-lightning Merge pull request #2731 from shaavan/issue2711 Delay broadcasting Channel Updates until connected to peers --- 1e54dd6a21a645f855c88cc95df85bea68aa23a9 diff --cc lightning/src/ln/channelmanager.rs index b3581fd69,09a17e42b..11d0b299e --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@@ -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 }); }