Skip to content

Commit ad36f13

Browse files
committed
f - test OnionMessageHandler::timer_tick_occurred is called
1 parent 2363265 commit ad36f13

File tree

1 file changed

+12
-4
lines changed
  • lightning-background-processor/src

1 file changed

+12
-4
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ const PING_TIMER: u64 = 30;
105105
#[cfg(test)]
106106
const PING_TIMER: u64 = 1;
107107

108+
#[cfg(not(test))]
108109
const ONION_MESSAGE_HANDLER_TIMER: u64 = 10;
110+
#[cfg(test)]
111+
const ONION_MESSAGE_HANDLER_TIMER: u64 = 1;
109112

110113
/// Prune the network graph of stale entries hourly.
111114
const NETWORK_PRUNE_TIMER: u64 = 60 * 60;
@@ -1401,9 +1404,11 @@ mod tests {
14011404

14021405
#[test]
14031406
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`.
14071412
let (_, nodes) = create_nodes(1, "test_timer_tick_called");
14081413
let data_dir = nodes[0].kv_store.get_data_dir();
14091414
let persister = Arc::new(Persister::new(data_dir));
@@ -1414,9 +1419,12 @@ mod tests {
14141419
let desired_log_1 = "Calling ChannelManager's timer_tick_occurred".to_string();
14151420
let desired_log_2 = "Calling PeerManager's timer_tick_occurred".to_string();
14161421
let desired_log_3 = "Rebroadcasting monitor's pending claims".to_string();
1422+
let desired_log_4 = "Calling OnionMessageHandler's timer_tick_occurred".to_string();
14171423
if log_entries.get(&("lightning_background_processor".to_string(), desired_log_1)).is_some() &&
14181424
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+
{
14201428
break
14211429
}
14221430
}

0 commit comments

Comments
 (0)