From 38584e3efe911b00de356097865c83c7afe05647 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 2 Nov 2018 10:54:25 -0400 Subject: [PATCH] Avoid double-panic in full_stack_target to assist debugging --- fuzz/fuzz_targets/full_stack_target.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fuzz/fuzz_targets/full_stack_target.rs b/fuzz/fuzz_targets/full_stack_target.rs index 19b3e843..f9439455 100644 --- a/fuzz/fuzz_targets/full_stack_target.rs +++ b/fuzz/fuzz_targets/full_stack_target.rs @@ -209,15 +209,17 @@ impl<'a> MoneyLossDetector<'a> { impl<'a> Drop for MoneyLossDetector<'a> { fn drop(&mut self) { - // Disconnect all peers - for (idx, peer) in self.peers.borrow().iter().enumerate() { - if *peer { - self.handler.disconnect_event(&Peer{id: idx as u8, peers_connected: &self.peers}); + if !::std::thread::panicking() { + // Disconnect all peers + for (idx, peer) in self.peers.borrow().iter().enumerate() { + if *peer { + self.handler.disconnect_event(&Peer{id: idx as u8, peers_connected: &self.peers}); + } } - } - // Force all channels onto the chain (and time out claim txn) - self.manager.force_close_all_channels(); + // Force all channels onto the chain (and time out claim txn) + self.manager.force_close_all_channels(); + } } } -- 2.30.2