@@ -105,7 +105,10 @@ const PING_TIMER: u64 = 30;
105
105
#[ cfg( test) ]
106
106
const PING_TIMER : u64 = 1 ;
107
107
108
+ #[ cfg( not( test) ) ]
108
109
const ONION_MESSAGE_HANDLER_TIMER : u64 = 10 ;
110
+ #[ cfg( test) ]
111
+ const ONION_MESSAGE_HANDLER_TIMER : u64 = 1 ;
109
112
110
113
/// Prune the network graph of stale entries hourly.
111
114
const NETWORK_PRUNE_TIMER : u64 = 60 * 60 ;
@@ -1401,9 +1404,11 @@ mod tests {
1401
1404
1402
1405
#[ test]
1403
1406
fn test_timer_tick_called ( ) {
1404
- // Test that `ChannelManager::timer_tick_occurred` is called every `FRESHNESS_TIMER`,
1405
- // `ChainMonitor::rebroadcast_pending_claims` is called every `REBROADCAST_TIMER`, and
1406
- // `PeerManager::timer_tick_occurred` every `PING_TIMER`.
1407
+ // Test that:
1408
+ // - `ChannelManager::timer_tick_occurred` is called every `FRESHNESS_TIMER`,
1409
+ // - `ChainMonitor::rebroadcast_pending_claims` is called every `REBROADCAST_TIMER`,
1410
+ // - `PeerManager::timer_tick_occurred` is called every `PING_TIMER`, and
1411
+ // - `OnionMessageHandler::timer_tick_occurred` is called every `ONION_MESSAGE_HANDLER_TIMER`.
1407
1412
let ( _, nodes) = create_nodes ( 1 , "test_timer_tick_called" ) ;
1408
1413
let data_dir = nodes[ 0 ] . kv_store . get_data_dir ( ) ;
1409
1414
let persister = Arc :: new ( Persister :: new ( data_dir) ) ;
@@ -1414,9 +1419,12 @@ mod tests {
1414
1419
let desired_log_1 = "Calling ChannelManager's timer_tick_occurred" . to_string ( ) ;
1415
1420
let desired_log_2 = "Calling PeerManager's timer_tick_occurred" . to_string ( ) ;
1416
1421
let desired_log_3 = "Rebroadcasting monitor's pending claims" . to_string ( ) ;
1422
+ let desired_log_4 = "Calling OnionMessageHandler's timer_tick_occurred" . to_string ( ) ;
1417
1423
if log_entries. get ( & ( "lightning_background_processor" . to_string ( ) , desired_log_1) ) . is_some ( ) &&
1418
1424
log_entries. get ( & ( "lightning_background_processor" . to_string ( ) , desired_log_2) ) . is_some ( ) &&
1419
- log_entries. get ( & ( "lightning_background_processor" . to_string ( ) , desired_log_3) ) . is_some ( ) {
1425
+ log_entries. get ( & ( "lightning_background_processor" . to_string ( ) , desired_log_3) ) . is_some ( ) &&
1426
+ log_entries. get ( & ( "lightning_background_processor" . to_string ( ) , desired_log_4) ) . is_some ( )
1427
+ {
1420
1428
break
1421
1429
}
1422
1430
}
0 commit comments