diff --git a/presage/src/manager/linking.rs b/presage/src/manager/linking.rs index c7674ed66..eebfe9fcd 100644 --- a/presage/src/manager/linking.rs +++ b/presage/src/manager/linking.rs @@ -137,11 +137,19 @@ impl Manager { ®istration_data.service_ids ); - Ok(Manager { + let mut manager = Manager { rng, - store, + store: store.clone(), state: Registered::with_data(registration_data), - }) + }; + + // Register pre-keys with the server. If this fails, this can lead to issues receiving, in that case clear the registration and propagate the error. + if let Err(e) = manager.register_pre_keys().await { + store.clear_registration()?; + Err(e) + } else { + Ok(manager) + } } Err(e) => { store.clear_registration()?;