From 8d706789e717797ff37fdf8c999c14a09d2ac9a5 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 27 Sep 2018 17:36:10 -0400 Subject: [PATCH] Avoid double-panic in ChannelManager when tests fail --- src/ln/channelmanager.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ln/channelmanager.rs b/src/ln/channelmanager.rs index 402ac97b3..bcb928cca 100644 --- a/src/ln/channelmanager.rs +++ b/src/ln/channelmanager.rs @@ -2462,9 +2462,11 @@ mod tests { } impl Drop for Node { fn drop(&mut self) { - // Check that we processed all pending events - assert_eq!(self.node.get_and_clear_pending_events().len(), 0); - assert_eq!(self.chan_monitor.added_monitors.lock().unwrap().len(), 0); + if !::std::thread::panicking() { + // Check that we processed all pending events + assert_eq!(self.node.get_and_clear_pending_events().len(), 0); + assert_eq!(self.chan_monitor.added_monitors.lock().unwrap().len(), 0); + } } } -- 2.39.5