@@ -202,39 +202,6 @@ fn handle_network_graph_update<L: Deref>(
202
202
}
203
203
}
204
204
205
- /// Decorates an [`EventHandler`] with common functionality provided by standard [`EventHandler`]s.
206
- struct DecoratingEventHandler <
207
- ' a ,
208
- E : EventHandler ,
209
- PGS : Deref < Target = P2PGossipSync < G , A , L > > ,
210
- RGS : Deref < Target = RapidGossipSync < G , L > > ,
211
- G : Deref < Target = NetworkGraph < L > > ,
212
- A : Deref ,
213
- L : Deref ,
214
- >
215
- where A :: Target : chain:: Access , L :: Target : Logger {
216
- event_handler : E ,
217
- gossip_sync : & ' a GossipSync < PGS , RGS , G , A , L > ,
218
- }
219
-
220
- impl <
221
- ' a ,
222
- E : EventHandler ,
223
- PGS : Deref < Target = P2PGossipSync < G , A , L > > ,
224
- RGS : Deref < Target = RapidGossipSync < G , L > > ,
225
- G : Deref < Target = NetworkGraph < L > > ,
226
- A : Deref ,
227
- L : Deref ,
228
- > EventHandler for DecoratingEventHandler < ' a , E , PGS , RGS , G , A , L >
229
- where A :: Target : chain:: Access , L :: Target : Logger {
230
- fn handle_event ( & self , event : Event ) {
231
- if let Some ( network_graph) = self . gossip_sync . network_graph ( ) {
232
- handle_network_graph_update ( network_graph, & event)
233
- }
234
- self . event_handler . handle_event ( event) ;
235
- }
236
- }
237
-
238
205
macro_rules! define_run_body {
239
206
( $persister: ident, $chain_monitor: ident, $process_chain_monitor_events: expr,
240
207
$channel_manager: ident, $process_channel_manager_events: expr,
@@ -536,9 +503,12 @@ impl BackgroundProcessor {
536
503
let stop_thread = Arc :: new ( AtomicBool :: new ( false ) ) ;
537
504
let stop_thread_clone = stop_thread. clone ( ) ;
538
505
let handle = thread:: spawn ( move || -> Result < ( ) , std:: io:: Error > {
539
- let event_handler = DecoratingEventHandler {
540
- event_handler,
541
- gossip_sync : & gossip_sync,
506
+ let event_handler = |event| {
507
+ let network_graph = gossip_sync. network_graph ( ) ;
508
+ if let Some ( network_graph) = network_graph {
509
+ handle_network_graph_update ( network_graph, & event)
510
+ }
511
+ event_handler. handle_event ( event) ;
542
512
} ;
543
513
define_run_body ! ( persister, chain_monitor, chain_monitor. process_pending_events( & event_handler) ,
544
514
channel_manager, channel_manager. process_pending_events( & event_handler) ,
0 commit comments