Removing the snodes version patch

This commit is contained in:
ThomasSession 2024-08-01 09:01:56 +10:00
parent b089677860
commit 80216e995e
3 changed files with 0 additions and 33 deletions

View File

@ -216,16 +216,6 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
MessagingModuleConfiguration.configure(this);
super.onCreate();
// we need to clear the snode and onionrequest databases once on first launch
// in order to apply a patch that adds a version number to the Snode objects.
if(!TextSecurePreferences.hasAppliedPatchSnodeVersion(this)) {
ThreadUtils.queue(() -> {
lokiAPIDatabase.clearSnodePool();
lokiAPIDatabase.clearOnionRequestPaths();
TextSecurePreferences.setHasAppliedPatchSnodeVersion(this, true);
});
}
messagingModuleConfiguration = new MessagingModuleConfiguration(
this,
storage,

View File

@ -193,17 +193,6 @@ object OnionRequestAPI {
val result = listOf( guardSnode ) + (0 until (pathSize - 1)).mapIndexed() { index, _ ->
var pathSnode = unusedSnodes.getRandomElement()
// For the last node: We need to make sure the version is >= 2.8.0
// to help with an issue that will disappear once the nodes are all updated
if(index == pathSize - 2) {
val suitableSnodes = unusedSnodes.filter { Util.compareVersions(it.version, "2.8.0") >= 0 }
pathSnode = if (suitableSnodes.isNotEmpty()) {
suitableSnodes.random()
} else {
throw InsufficientSnodesException()
}
}
// remove the snode from the unused list and return it
unusedSnodes = unusedSnodes.minus(pathSnode)
pathSnode

View File

@ -301,8 +301,6 @@ interface TextSecurePreferences {
const val ALLOW_MESSAGE_REQUESTS = "libsession.ALLOW_MESSAGE_REQUESTS"
const val PATCH_SNODE_VERSION_2024_07_23 = "libsession.patch_snode_version_2024_07_23"
@JvmStatic
fun getLastConfigurationSyncTime(context: Context): Long {
return getLongPreference(context, LAST_CONFIGURATION_SYNC_TIME, 0)
@ -987,16 +985,6 @@ interface TextSecurePreferences {
fun clearAll(context: Context) {
getDefaultSharedPreferences(context).edit().clear().commit()
}
@JvmStatic
fun hasAppliedPatchSnodeVersion(context: Context): Boolean {
return getBooleanPreference(context, PATCH_SNODE_VERSION_2024_07_23, false)
}
@JvmStatic
fun setHasAppliedPatchSnodeVersion(context: Context, applied: Boolean) {
setBooleanPreference(context, PATCH_SNODE_VERSION_2024_07_23, applied)
}
}
}