Skip to content

Commit 2248427

Browse files
committed
f simplify new BP logic
1 parent bca316d commit 2248427

File tree

1 file changed

+2
-6
lines changed
  • lightning-background-processor/src

1 file changed

+2
-6
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,7 @@ impl BackgroundProcessor {
208208
let stop_thread = Arc::new(AtomicBool::new(false));
209209
let stop_thread_clone = stop_thread.clone();
210210
let handle = thread::spawn(move || -> Result<(), std::io::Error> {
211-
let event_handler = if let Some(ref handler) = net_graph_msg_handler {
212-
DecoratingEventHandler { event_handler, net_graph_msg_handler: Some(&**handler) }
213-
} else {
214-
DecoratingEventHandler { event_handler, net_graph_msg_handler: None }
215-
};
211+
let event_handler = DecoratingEventHandler { event_handler, net_graph_msg_handler: net_graph_msg_handler.as_ref().map(|t| t.deref()) };
216212

217213
log_trace!(logger, "Calling ChannelManager's timer_tick_occurred on startup");
218214
channel_manager.timer_tick_occurred();
@@ -261,7 +257,7 @@ impl BackgroundProcessor {
261257
if last_prune_call.elapsed().as_secs() > NETWORK_PRUNE_TIMER {
262258
if let Some(ref handler) = net_graph_msg_handler {
263259
log_trace!(logger, "Pruning network graph of stale entries");
264-
(*handler.deref()).network_graph().remove_stale_channels();
260+
handler.network_graph().remove_stale_channels();
265261
last_prune_call = Instant::now();
266262
}
267263
}

0 commit comments

Comments
 (0)