Merge pull request #1587 from oxen-io/feature/remove-snode-version-patch

Removing the snodes version patch
This commit is contained in:
ThomasSession 2024-08-01 11:36:20 +10:00 committed by GitHub
commit 2a5f86ea06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 0 additions and 33 deletions

View File

@ -215,16 +215,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

@ -296,8 +296,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)
@ -982,16 +980,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)
}
}
}