Fix bug, parse_cipher keeps a cipher we can't decrypt
This commit is contained in:
parent
8ca4023d21
commit
4b8d5c3611
16
src/api.rs
16
src/api.rs
@ -1111,10 +1111,18 @@ pub fn parse_cipher(cipher_msg: String) -> ApiResult<ApiReturn> {
|
|||||||
.map_err(|e| ApiError::new(format!("Failed to handle decrypted message: {}", e)));
|
.map_err(|e| ApiError::new(format!("Failed to handle decrypted message: {}", e)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If both decryption attempts fail, return an error
|
// If both decryption attempts fail, we keep it just in case we receive the transaction later
|
||||||
Err(ApiError::new(
|
let mut return_msg = CachedMessage::new();
|
||||||
"Failed to decrypt cipher with any known method".to_owned(),
|
return_msg.cipher = vec![cipher_msg];
|
||||||
))
|
return_msg.status = CachedMessageStatus::CipherWaitingTx;
|
||||||
|
|
||||||
|
let mut messages_cache = lock_messages()?;
|
||||||
|
messages_cache.push(return_msg.clone());
|
||||||
|
|
||||||
|
Ok(ApiReturn {
|
||||||
|
updated_cached_msg: vec![return_msg],
|
||||||
|
..Default::default()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user