From: Matt Corallo Date: Thu, 27 Sep 2018 21:36:10 +0000 (-0400) Subject: Avoid double-panic in ChannelManager when tests fail X-Git-Tag: v0.0.12~300^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=8d706789e717797ff37fdf8c999c14a09d2ac9a5;p=rust-lightning Avoid double-panic in ChannelManager when tests fail --- 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); + } } }