Skip to content

Commit 38bd353

Browse files
committed
f use a constant
1 parent 0760f99 commit 38bd353

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lightning/src/ln/channelmanager.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -3309,6 +3309,11 @@ macro_rules! handle_monitor_update_completion {
33093309
} }
33103310
}
33113311

3312+
#[cfg(not(any(test, feature = "_externalize_tests")))]
3313+
const SYNC_UPDATE: usize = 1;
3314+
#[cfg(not(any(test, feature = "_externalize_tests")))]
3315+
const ASYNC_UPDATE: usize = 2;
3316+
33123317
macro_rules! handle_new_monitor_update {
33133318
($self: ident, $update_res: expr, $logger: expr, $channel_id: expr, _internal, $completed: expr) => { {
33143319
debug_assert!($self.background_events_processed_since_startup.load(Ordering::Acquire));
@@ -3320,7 +3325,7 @@ macro_rules! handle_new_monitor_update {
33203325
},
33213326
ChannelMonitorUpdateStatus::InProgress => {
33223327
#[cfg(not(any(test, feature = "_externalize_tests")))]
3323-
if $self.monitor_update_type.swap(1, Ordering::Relaxed) == 2 {
3328+
if $self.monitor_update_type.swap(ASYNC_UPDATE, Ordering::Relaxed) == SYNC_UPDATE {
33243329
panic!("Cannot use both ChannelMonitorUpdateStatus modes InProgress and Completed without restart");
33253330
}
33263331
log_debug!($logger, "ChannelMonitor update for {} in flight, holding messages until the update completes.",
@@ -3329,7 +3334,7 @@ macro_rules! handle_new_monitor_update {
33293334
},
33303335
ChannelMonitorUpdateStatus::Completed => {
33313336
#[cfg(not(any(test, feature = "_externalize_tests")))]
3332-
if $self.monitor_update_type.swap(2, Ordering::Relaxed) == 1 {
3337+
if $self.monitor_update_type.swap(SYNC_UPDATE, Ordering::Relaxed) == ASYNC_UPDATE {
33333338
panic!("Cannot use both ChannelMonitorUpdateStatus modes InProgress and Completed without restart");
33343339
}
33353340
$completed;

0 commit comments

Comments
 (0)