]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Avoid double-panic in ChannelManager when tests fail
authorMatt Corallo <git@bluematt.me>
Thu, 27 Sep 2018 21:36:10 +0000 (17:36 -0400)
committerMatt Corallo <git@bluematt.me>
Fri, 28 Sep 2018 22:55:31 +0000 (18:55 -0400)
src/ln/channelmanager.rs

index 402ac97b37286a2573e54e2a049fb8ab6bf5bf15..bcb928cca8f025ceb484b1a5dcaf594fe3158850 100644 (file)
@@ -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);
+                       }
                }
        }