Skip to content

Commit f2f6fd3

Browse files
committed
f duh
1 parent 666a7dd commit f2f6fd3

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,11 @@ macro_rules! process_events_body {
17161716

17171717
let _single_processor = $self.pending_events_processor.lock().unwrap();
17181718
loop {
1719+
#[cfg(debug_assertions)]
17191720
let mut next_event = $self.pending_events.lock().unwrap().front().map(|ev| (*ev).clone());
1721+
#[cfg(not(debug_assertions))]
1722+
let mut next_event = $self.pending_events.lock().unwrap().pop_front();
1723+
17201724
let mut post_event_actions = Vec::new();
17211725
loop {
17221726
if let Some((event, action_opt)) = next_event {
@@ -1727,20 +1731,23 @@ macro_rules! process_events_body {
17271731
}
17281732
$event_to_handle = event;
17291733
$handle_event;
1730-
let mut pending_events = $self.pending_events.lock().unwrap();
1731-
// We're required to take the `pending_events_processor` lock any time we
1732-
// remove from `pending_events`, however have no general way to enforce that.
1733-
// Instead, here, we assert that the next event hasn't changed out from under
1734-
// us.
17351734
#[cfg(debug_assertions)] {
1735+
let mut pending_events = $self.pending_events.lock().unwrap();
1736+
// We're required to take the `pending_events_processor` lock any time we
1737+
// remove from `pending_events`, however have no general way to enforce that.
1738+
// Instead, here, we assert that the next event hasn't changed out from under
1739+
// us.
17361740
debug_assert_eq!(_ev_clone, pending_events.front().unwrap().0);
1741+
debug_assert_eq!(action_opt, pending_events.front().unwrap().1);
1742+
pending_events.pop_front();
1743+
next_event = pending_events.front().map(|ev| ev.clone());
1744+
}
1745+
#[cfg(not(debug_assertions))] {
1746+
next_event = pending_events.pop_front();
17371747
}
1738-
debug_assert_eq!(action_opt, pending_events.front().unwrap().1);
17391748
if let Some(action) = action_opt {
17401749
post_event_actions.push(action);
17411750
}
1742-
pending_events.pop_front();
1743-
next_event = pending_events.front().map(|ev| ev.clone());
17441751
} else {
17451752
break;
17461753
}

0 commit comments

Comments
 (0)