Skip to content

Commit 38584e3

Browse files
committed
Avoid double-panic in full_stack_target to assist debugging
1 parent 366e796 commit 38584e3

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

fuzz/fuzz_targets/full_stack_target.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,17 @@ impl<'a> MoneyLossDetector<'a> {
209209

210210
impl<'a> Drop for MoneyLossDetector<'a> {
211211
fn drop(&mut self) {
212-
// Disconnect all peers
213-
for (idx, peer) in self.peers.borrow().iter().enumerate() {
214-
if *peer {
215-
self.handler.disconnect_event(&Peer{id: idx as u8, peers_connected: &self.peers});
212+
if !::std::thread::panicking() {
213+
// Disconnect all peers
214+
for (idx, peer) in self.peers.borrow().iter().enumerate() {
215+
if *peer {
216+
self.handler.disconnect_event(&Peer{id: idx as u8, peers_connected: &self.peers});
217+
}
216218
}
217-
}
218219

219-
// Force all channels onto the chain (and time out claim txn)
220-
self.manager.force_close_all_channels();
220+
// Force all channels onto the chain (and time out claim txn)
221+
self.manager.force_close_all_channels();
222+
}
221223
}
222224
}
223225

0 commit comments

Comments
 (0)