Don't cache entities with min flag set, bump v1.10.2

Since layer 102, there are two access_hash. One with the min flag,
and one without it. This was causing channel invalid errors.

access_hash with min flag set can only be used to fetch files such
as profile pictures.

access_hash with min flag unset can be used under all circumstances.

Previously, the library did not distinguish between these, so it was
caching the hash that could hardly be used for anything.

With this change, only the "full" access_hash is stored, which will
work for any methods.

See also: https://core.telegram.org/api/min
This commit is contained in:
Lonami Exo
2019-09-12 19:17:32 +02:00
parent 5c72e1286e
commit 9c06f29aaf
4 changed files with 57 additions and 11 deletions

View File

@@ -17,7 +17,7 @@ except ImportError as e:
sqlite3_err = type(e)
EXTENSION = '.session'
CURRENT_VERSION = 5 # database version
CURRENT_VERSION = 6 # database version
class SQLiteSession(MemorySession):
@@ -143,6 +143,12 @@ class SQLiteSession(MemorySession):
if old == 4:
old += 1
c.execute("alter table sessions add column takeout_id integer")
if old == 5:
# Not really any schema upgrade, but potentially all access
# hashes for User and Channel are wrong, so drop them off.
old += 1
c.execute('delete from entities')
c.close()
@staticmethod