mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 04:35:24 +00:00
Raise directly when not checking a boolean expression
This commit is contained in:
parent
8aa358129c
commit
ea3281b5f6
@ -106,21 +106,21 @@ def unpack(
|
||||
if stored_msg_ids:
|
||||
# Ignored message: msg_id is lower than all of the stored values
|
||||
if message.msg_id < stored_msg_ids[0]:
|
||||
SecurityCheckMismatch.check(False)
|
||||
raise SecurityCheckMismatch
|
||||
|
||||
# Ignored message: msg_id is equal to any of the stored values
|
||||
if message.msg_id in stored_msg_ids:
|
||||
SecurityCheckMismatch.check(False)
|
||||
raise SecurityCheckMismatch
|
||||
|
||||
time_diff = (message.msg_id - MsgId()) / 2 ** 32
|
||||
|
||||
# Ignored message: msg_id belongs over 30 seconds in the future
|
||||
if time_diff > 30:
|
||||
SecurityCheckMismatch.check(False)
|
||||
raise SecurityCheckMismatch
|
||||
|
||||
# Ignored message: msg_id belongs over 300 seconds in the past
|
||||
if time_diff < -300:
|
||||
SecurityCheckMismatch.check(False)
|
||||
raise SecurityCheckMismatch
|
||||
|
||||
bisect.insort(stored_msg_ids, message.msg_id)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user