@@ -10,6 +10,7 @@ use lightning::ln::msgs::{
10
10
} ;
11
11
use lightning:: routing:: gossip:: NetworkGraph ;
12
12
use lightning:: util:: logger:: Logger ;
13
+ use lightning:: { log_warn, log_trace, log_given_level} ;
13
14
use lightning:: util:: ser:: { BigSize , Readable } ;
14
15
use lightning:: io;
15
16
@@ -120,6 +121,7 @@ impl<NG: Deref<Target=NetworkGraph<L>>, L: Deref> RapidGossipSync<NG, L> where L
120
121
if let ErrorAction :: IgnoreDuplicateGossip = lightning_error. action {
121
122
// everything is fine, just a duplicate channel announcement
122
123
} else {
124
+ log_warn ! ( self . logger, "Failed to process channel announcement: {:?}" , lightning_error) ;
123
125
return Err ( lightning_error. into ( ) ) ;
124
126
}
125
127
}
@@ -179,6 +181,9 @@ impl<NG: Deref<Target=NetworkGraph<L>>, L: Deref> RapidGossipSync<NG, L> where L
179
181
synthetic_update. fee_base_msat = directional_info. fees . base_msat ;
180
182
synthetic_update. fee_proportional_millionths = directional_info. fees . proportional_millionths ;
181
183
} else {
184
+ log_trace ! ( self . logger,
185
+ "Skipping application of channel update for chan {} with flags {} as original data is missing." ,
186
+ short_channel_id, channel_flags) ;
182
187
skip_update_for_unknown_channel = true ;
183
188
}
184
189
} ;
@@ -215,7 +220,9 @@ impl<NG: Deref<Target=NetworkGraph<L>>, L: Deref> RapidGossipSync<NG, L> where L
215
220
match network_graph. update_channel_unsigned ( & synthetic_update) {
216
221
Ok ( _) => { } ,
217
222
Err ( LightningError { action : ErrorAction :: IgnoreDuplicateGossip , .. } ) => { } ,
218
- Err ( LightningError { action : ErrorAction :: IgnoreAndLog ( _) , .. } ) => { } ,
223
+ Err ( LightningError { action : ErrorAction :: IgnoreAndLog ( level) , err } ) => {
224
+ log_given_level ! ( self . logger, level, "Failed to apply channel update: {:?}" , err) ;
225
+ } ,
219
226
Err ( LightningError { action : ErrorAction :: IgnoreError , .. } ) => { } ,
220
227
Err ( e) => return Err ( e. into ( ) ) ,
221
228
}
@@ -281,7 +288,7 @@ mod tests {
281
288
0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 58 , 85 , 116 , 216 , 255 , 2 , 68 , 226 , 0 , 6 , 11 , 0 , 1 , 24 , 0 ,
282
289
0 , 3 , 232 , 0 , 0 , 0 ,
283
290
] ;
284
- let rapid_sync = RapidGossipSync :: new ( & network_graph) ;
291
+ let rapid_sync = RapidGossipSync :: new ( & network_graph, & logger ) ;
285
292
let update_result = rapid_sync. update_network_graph ( & example_input[ ..] ) ;
286
293
assert ! ( update_result. is_err( ) ) ;
287
294
if let Err ( GraphSyncError :: DecodeError ( DecodeError :: ShortRead ) ) = update_result {
@@ -307,7 +314,7 @@ mod tests {
307
314
308
315
assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 0 ) ;
309
316
310
- let rapid_sync = RapidGossipSync :: new ( & network_graph) ;
317
+ let rapid_sync = RapidGossipSync :: new ( & network_graph, & logger ) ;
311
318
let update_result = rapid_sync. update_network_graph ( & incremental_update_input[ ..] ) ;
312
319
assert ! ( update_result. is_ok( ) ) ;
313
320
}
@@ -336,7 +343,7 @@ mod tests {
336
343
337
344
assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 0 ) ;
338
345
339
- let rapid_sync = RapidGossipSync :: new ( & network_graph) ;
346
+ let rapid_sync = RapidGossipSync :: new ( & network_graph, & logger ) ;
340
347
rapid_sync. update_network_graph ( & announced_update_input[ ..] ) . unwrap ( ) ;
341
348
}
342
349
@@ -364,7 +371,7 @@ mod tests {
364
371
365
372
assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 0 ) ;
366
373
367
- let rapid_sync = RapidGossipSync :: new ( & network_graph) ;
374
+ let rapid_sync = RapidGossipSync :: new ( & network_graph, & logger ) ;
368
375
let initialization_result = rapid_sync. update_network_graph ( & initialization_input[ ..] ) ;
369
376
if initialization_result. is_err ( ) {
370
377
panic ! (
@@ -422,7 +429,7 @@ mod tests {
422
429
423
430
assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 0 ) ;
424
431
425
- let rapid_sync = RapidGossipSync :: new ( & network_graph) ;
432
+ let rapid_sync = RapidGossipSync :: new ( & network_graph, & logger ) ;
426
433
let initialization_result = rapid_sync. update_network_graph ( & initialization_input[ ..] ) ;
427
434
assert ! ( initialization_result. is_ok( ) ) ;
428
435
@@ -482,7 +489,7 @@ mod tests {
482
489
483
490
assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 0 ) ;
484
491
485
- let rapid_sync = RapidGossipSync :: new ( & network_graph) ;
492
+ let rapid_sync = RapidGossipSync :: new ( & network_graph, & logger ) ;
486
493
let initialization_result = rapid_sync. update_network_graph ( & initialization_input[ ..] ) ;
487
494
assert ! ( initialization_result. is_ok( ) ) ;
488
495
@@ -508,7 +515,7 @@ mod tests {
508
515
509
516
assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 0 ) ;
510
517
511
- let rapid_sync = RapidGossipSync :: new ( & network_graph) ;
518
+ let rapid_sync = RapidGossipSync :: new ( & network_graph, & logger ) ;
512
519
let update_result = rapid_sync. update_network_graph ( & VALID_RGS_BINARY ) ;
513
520
if update_result. is_err ( ) {
514
521
panic ! ( "Unexpected update result: {:?}" , update_result)
@@ -540,7 +547,7 @@ mod tests {
540
547
541
548
assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 0 ) ;
542
549
543
- let rapid_sync = RapidGossipSync :: new ( & network_graph) ;
550
+ let rapid_sync = RapidGossipSync :: new ( & network_graph, & logger ) ;
544
551
// this is mostly for checking uint underflow issues before the fuzzer does
545
552
let update_result = rapid_sync. update_network_graph_no_std ( & VALID_RGS_BINARY , Some ( 0 ) ) ;
546
553
assert ! ( update_result. is_ok( ) ) ;
@@ -560,7 +567,7 @@ mod tests {
560
567
let network_graph = NetworkGraph :: new ( block_hash, & logger) ;
561
568
assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 0 ) ;
562
569
563
- let rapid_sync = RapidGossipSync :: new ( & network_graph) ;
570
+ let rapid_sync = RapidGossipSync :: new ( & network_graph, & logger ) ;
564
571
let update_result = rapid_sync. update_network_graph_no_std ( & VALID_RGS_BINARY , Some ( latest_succeeding_time) ) ;
565
572
assert ! ( update_result. is_ok( ) ) ;
566
573
assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 2 ) ;
@@ -570,7 +577,7 @@ mod tests {
570
577
let network_graph = NetworkGraph :: new ( block_hash, & logger) ;
571
578
assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 0 ) ;
572
579
573
- let rapid_sync = RapidGossipSync :: new ( & network_graph) ;
580
+ let rapid_sync = RapidGossipSync :: new ( & network_graph, & logger ) ;
574
581
let update_result = rapid_sync. update_network_graph_no_std ( & VALID_RGS_BINARY , Some ( earliest_failing_time) ) ;
575
582
assert ! ( update_result. is_err( ) ) ;
576
583
if let Err ( GraphSyncError :: LightningError ( lightning_error) ) = update_result {
@@ -607,7 +614,7 @@ mod tests {
607
614
let block_hash = genesis_block ( Network :: Bitcoin ) . block_hash ( ) ;
608
615
let logger = TestLogger :: new ( ) ;
609
616
let network_graph = NetworkGraph :: new ( block_hash, & logger) ;
610
- let rapid_sync = RapidGossipSync :: new ( & network_graph) ;
617
+ let rapid_sync = RapidGossipSync :: new ( & network_graph, & logger ) ;
611
618
let update_result = rapid_sync. update_network_graph ( & unknown_version_input[ ..] ) ;
612
619
613
620
assert ! ( update_result. is_err( ) ) ;
0 commit comments