test: increase ping timeout when running in debug mode
[rust-lightning] / lightning-background-processor / src / lib.rs
index e73ddeb709c11aca96ea04887c4eca2cb6cea388..a0751a9d0f4b3055fdb605a95c46033f55ce0e2b 100644 (file)
@@ -50,7 +50,13 @@ const FRESHNESS_TIMER: u64 = 60;
 #[cfg(test)]
 const FRESHNESS_TIMER: u64 = 1;
 
+#[cfg(not(debug_assertions))]
 const PING_TIMER: u64 = 5;
+/// Signature operations take a lot longer without compiler optimisations.
+/// Increasing the ping timer allows for this but slower devices will be disconnected if the
+/// timeout is reached.
+#[cfg(debug_assertions)]
+const PING_TIMER: u64 = 30;
 
 /// Trait which handles persisting a [`ChannelManager`] to disk.
 ///
@@ -140,6 +146,9 @@ impl BackgroundProcessor {
                let stop_thread = Arc::new(AtomicBool::new(false));
                let stop_thread_clone = stop_thread.clone();
                let handle = thread::spawn(move || -> Result<(), std::io::Error> {
+                       log_trace!(logger, "Calling ChannelManager's timer_tick_occurred on startup");
+                       channel_manager.timer_tick_occurred();
+
                        let mut last_freshness_call = Instant::now();
                        let mut last_ping_call = Instant::now();
                        loop {