Fix bug double mutex on processes
This commit is contained in:
parent
3372bcb1ed
commit
87113f5a34
@ -1062,9 +1062,7 @@ fn handle_decrypted_message(
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_cipher(cipher_msg: String) -> ApiResult<ApiReturn> {
|
||||
// We lock message cache and processes to prevent race conditions
|
||||
let mut messages = lock_messages()?;
|
||||
let processes = lock_processes()?;
|
||||
|
||||
// Check that the cipher is not empty or too long
|
||||
if cipher_msg.is_empty() || cipher_msg.len() > MAX_PRD_PAYLOAD_SIZE {
|
||||
@ -1082,6 +1080,7 @@ pub fn parse_cipher(cipher_msg: String) -> ApiResult<ApiReturn> {
|
||||
}
|
||||
|
||||
// If that fails, try decrypting with known processes
|
||||
let processes = lock_processes()?;
|
||||
if let Ok(Some((plain, root_commitment))) = decrypt_with_known_processes(&cipher, processes) {
|
||||
return handle_decrypted_message(plain, None, Some(root_commitment))
|
||||
.map_err(|e| ApiError::new(format!("Failed to handle decrypted message: {}", e)));
|
||||
|
Loading…
x
Reference in New Issue
Block a user