From: Matt Corallo Date: Fri, 2 Nov 2018 14:54:25 +0000 (-0400) Subject: Avoid double-panic in full_stack_target to assist debugging X-Git-Tag: v0.0.12~277^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=refs%2Fheads%2F2018-10-peer-free-panic;p=rust-lightning Avoid double-panic in full_stack_target to assist debugging --- diff --git a/fuzz/fuzz_targets/full_stack_target.rs b/fuzz/fuzz_targets/full_stack_target.rs index 19b3e843a..f94394553 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(); + } } }