+ /// Latency/peer disconnection may trigger us to mark as disabled some
+ /// of our channels. After some time, if channels are still disabled
+ /// we need to broadcast ChannelUpdate to inform other network peers
+ /// about the uselessness of this channels.
+ pub fn timer_chan_freshness_every_min(&self) {
+ let _ = self.total_consistency_lock.read().unwrap();
+ let mut channel_state_lock = self.channel_state.lock().unwrap();
+ let channel_state = channel_state_lock.borrow_parts();
+ for (_, chan) in channel_state.by_id {
+ if chan.is_disabled_staged() && !chan.is_live() {
+ if let Ok(update) = self.get_channel_update(&chan) {
+ channel_state.pending_msg_events.push(events::MessageSendEvent::BroadcastChannelUpdate {
+ msg: update
+ });
+ }
+ chan.to_fresh();
+ } else if chan.is_disabled_staged() && chan.is_live() {
+ chan.to_fresh();
+ } else if chan.is_disabled_marked() {
+ chan.to_disabled_staged();
+ }
+ }
+ }
+