From ea3281b5f62caa916ea6f1ebb2f406bb66a2b36f Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 16 Dec 2021 21:39:52 +0100 Subject: [PATCH] Raise directly when not checking a boolean expression --- pyrogram/crypto/mtproto.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyrogram/crypto/mtproto.py b/pyrogram/crypto/mtproto.py index ccea119c..2fc3b9f8 100644 --- a/pyrogram/crypto/mtproto.py +++ b/pyrogram/crypto/mtproto.py @@ -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)