From f37ab6e38ec987210b1c5e841fa7099d74705f74 Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Fri, 15 Nov 2019 09:43:44 +0300
Subject: [PATCH] Remove checked key property.

---
 Telegram/SourceFiles/mtproto/connection.cpp | 20 --------------------
 Telegram/SourceFiles/mtproto/session.h      | 10 ----------
 2 files changed, 30 deletions(-)

diff --git a/Telegram/SourceFiles/mtproto/connection.cpp b/Telegram/SourceFiles/mtproto/connection.cpp
index d7e0a95bf..0a056e5f0 100644
--- a/Telegram/SourceFiles/mtproto/connection.cpp
+++ b/Telegram/SourceFiles/mtproto/connection.cpp
@@ -1075,22 +1075,6 @@ void ConnectionPrivate::restart() {
 	_waitForReceivedTimer.cancel();
 	_waitForConnectedTimer.cancel();
 
-	auto key = _sessionData->getKey();
-	if (key) {
-		if (!_sessionData->isCheckedKey()) {
-			// No destroying in case of an error.
-			//
-			//if (mayBeBadKey) {
-			//	clearMessages();
-			//	_keyId = kRecreateKeyId;
-//				retryTimeout = 1; // no ddos please
-			//	LOG(("MTP Info: key may be bad and was not checked - but won't be destroyed, no log outs because of bad server right now..."));
-			//}
-		} else {
-			_sessionData->setCheckedKey(false);
-		}
-	}
-
 	lockFinished.unlock();
 	doDisconnect();
 
@@ -1476,10 +1460,6 @@ void ConnectionPrivate::handleReceived() {
 		}
 		_retryTimeout = 1; // reset restart() timer
 
-		if (!_sessionData->isCheckedKey()) {
-			DEBUG_LOG(("MTP Info: marked auth key as checked"));
-			_sessionData->setCheckedKey(true);
-		}
 		_startedConnectingAt = crl::time(0);
 
 		if (!wasConnected) {
diff --git a/Telegram/SourceFiles/mtproto/session.h b/Telegram/SourceFiles/mtproto/session.h
index 839f3c797..17a69272a 100644
--- a/Telegram/SourceFiles/mtproto/session.h
+++ b/Telegram/SourceFiles/mtproto/session.h
@@ -189,15 +189,6 @@ public:
 	}
 	void setKeyForCheck(const AuthKeyPtr &key);
 
-	bool isCheckedKey() const {
-		QReadLocker locker(&_lock);
-		return _keyChecked;
-	}
-	void setCheckedKey(bool checked) {
-		QWriteLocker locker(&_lock);
-		_keyChecked = checked;
-	}
-
 	QReadWriteLock *keyMutex() const;
 
 	not_null<QReadWriteLock*> toSendMutex() const {
@@ -297,7 +288,6 @@ private:
 
 	AuthKeyPtr _authKey;
 	AuthKeyPtr _dcKeyForCheck;
-	bool _keyChecked = false;
 	bool _layerInited = false;
 	ConnectionOptions _options;