Skip to content

Commit 8d70678

Browse files
committed
Avoid double-panic in ChannelManager when tests fail
1 parent 28e67db commit 8d70678

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ln/channelmanager.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2462,9 +2462,11 @@ mod tests {
24622462
}
24632463
impl Drop for Node {
24642464
fn drop(&mut self) {
2465-
// Check that we processed all pending events
2466-
assert_eq!(self.node.get_and_clear_pending_events().len(), 0);
2467-
assert_eq!(self.chan_monitor.added_monitors.lock().unwrap().len(), 0);
2465+
if !::std::thread::panicking() {
2466+
// Check that we processed all pending events
2467+
assert_eq!(self.node.get_and_clear_pending_events().len(), 0);
2468+
assert_eq!(self.chan_monitor.added_monitors.lock().unwrap().len(), 0);
2469+
}
24682470
}
24692471
}
24702472

0 commit comments

Comments
 (0)