From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Fri, 11 Nov 2022 06:08:51 +0000 (+0000) Subject: Merge pull request #1806 from arik-so/2022-10-background-processor-deparametrization X-Git-Tag: v0.0.113~43 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=49c9f1885dd7a564c0c78ad5f73ea4792c0171a8;p=rust-lightning Merge pull request #1806 from arik-so/2022-10-background-processor-deparametrization Remove generic `Signer` parameter where it can be inferred from `KeysInterface` --- 49c9f1885dd7a564c0c78ad5f73ea4792c0171a8 diff --cc lightning-background-processor/src/lib.rs index ec7d29256,5fb8499b6..ece82bcaa --- a/lightning-background-processor/src/lib.rs +++ b/lightning-background-processor/src/lib.rs @@@ -352,10 -378,9 +351,10 @@@ pub async fn process_events_async CMH: 'static + Deref + Send + Sync, RMH: 'static + Deref + Send + Sync, OMH: 'static + Deref + Send + Sync, - EH: 'static + EventHandler + Send, + EventHandlerFuture: core::future::Future, + EventHandler: Fn(Event) -> EventHandlerFuture, PS: 'static + Deref + Send, - M: 'static + Deref> + Send + Sync, + M: 'static + Deref::Signer, CF, T, F, L, P>> + Send + Sync, CM: 'static + Deref> + Send + Sync, PGS: 'static + Deref> + Send + Sync, RGS: 'static + Deref> + Send, @@@ -383,27 -408,15 +382,27 @@@ wher OMH::Target: 'static + OnionMessageHandler, RMH::Target: 'static + RoutingMessageHandler, UMH::Target: 'static + CustomMessageHandler, - PS::Target: 'static + Persister<'a, Signer, CW, T, K, F, L, SC>, + PS::Target: 'static + Persister<'a, CW, T, K, F, L, SC>, { - let mut should_continue = true; - define_run_body!(persister, event_handler, chain_monitor, channel_manager, - gossip_sync, peer_manager, logger, scorer, should_continue, { + let mut should_break = true; + let async_event_handler = |event| { + let network_graph = gossip_sync.network_graph(); + let event_handler = &event_handler; + async move { + if let Some(network_graph) = network_graph { + handle_network_graph_update(network_graph, &event) + } + event_handler(event).await; + } + }; + define_run_body!(persister, + chain_monitor, chain_monitor.process_pending_events_async(async_event_handler).await, + channel_manager, channel_manager.process_pending_events_async(async_event_handler).await, + gossip_sync, peer_manager, logger, scorer, should_break, { select_biased! { _ = channel_manager.get_persistable_update_future().fuse() => true, - cont = sleeper(Duration::from_millis(100)).fuse() => { - should_continue = cont; + exit = sleeper(Duration::from_millis(100)).fuse() => { + should_break = exit; false } }