You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like this method doesn't really care if the timestamp is pointing to distant future.
def _check_timestamp(self, timestamp):
"""Verify that timestamp is recentish."""
timestamp = int(timestamp)
now = int(time.time())
lapsed = now - timestamp
if lapsed > self.timestamp_threshold:
raise Error('Expired timestamp: given %d and now %s has a '
'greater difference than threshold %d' % (timestamp, now,
self.timestamp_threshold))
If the timestamp is greater than current time, 'lapsed' variable will be negative, and therefore always false.
500 > 300
True
-500 > 300
False
I fixed it like this to my code:
if abs(lapsed) > self.timestamp_threshold:
The text was updated successfully, but these errors were encountered:
Looks like this method doesn't really care if the timestamp is pointing to distant future.
If the timestamp is greater than current time, 'lapsed' variable will be negative, and therefore always false.
I fixed it like this to my code:
if abs(lapsed) > self.timestamp_threshold:
The text was updated successfully, but these errors were encountered: