Skip to content

Commit e54bbb6

Browse files
committed
sentry - access - Move ChannelIsExpired check on top of all checks
1 parent 4c767fb commit e54bbb6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sentry/src/access.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ pub async fn check_access(
3131
let current_time = Utc::now();
3232
let is_in_withdraw_period = current_time > channel.spec.withdraw_period_start;
3333

34+
if current_time > channel.valid_until {
35+
return Err(Error::ChannelIsExpired);
36+
}
37+
3438
// We're only sending a CLOSE
3539
// That's allowed for the creator normally, and for everyone during the withdraw period
3640
if events.iter().all(is_close_event)
@@ -44,10 +48,6 @@ pub async fn check_access(
4448
return Err(Error::OnlyCreatorCanCloseChannel);
4549
}
4650

47-
if current_time > channel.valid_until {
48-
return Err(Error::ChannelIsExpired);
49-
}
50-
5151
if is_in_withdraw_period {
5252
return Err(Error::ChannelIsInWithdrawPeriod);
5353
}

0 commit comments

Comments
 (0)