Skip to content

Commit

Permalink
Update xmtp_mls/src/groups/mls_sync.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Dakota Brink <[email protected]>
  • Loading branch information
mchenani and codabrink authored Feb 13, 2025
1 parent 8f99ea3 commit 2118139
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions xmtp_mls/src/groups/mls_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1780,27 +1780,19 @@ async fn calculate_membership_changes_with_keypackages<'a>(

tracing::info!("trying to validate keypackages");

#[cfg(any(test, feature = "test-utils"))]
let key_packages = {
#[cfg(any(test, feature = "test-utils"))]
{
if is_test_mode_upload_malformed_keypackage() {
let malformed_installations = get_test_mode_malformed_installations();
failed_installations.extend(malformed_installations.clone());

// Return only valid key packages (excluding malformed)
key_packages
.clone()
.into_iter()
.filter(|(id, _)| !malformed_installations.contains(id))
.collect::<HashMap<_, _>>()
} else {
key_packages.clone()
}
}

#[cfg(not(any(test, feature = "test-utils")))]
{
key_packages.clone()
if is_test_mode_upload_malformed_keypackage() {
let malformed_installations = get_test_mode_malformed_installations();
failed_installations.extend(malformed_installations);

// Return only valid key packages (excluding malformed)
key_packages
.into_iter()
.filter(|(id, _)| !malformed_installations.contains(id))
.collect::<HashMap<_, _>>()
} else {
key_packages
}
};

Expand Down

0 comments on commit 2118139

Please sign in to comment.