Remove unecessary check in create_update_message
This commit is contained in:
parent
b2f7f68726
commit
bdf75a6114
16
src/api.rs
16
src/api.rs
@ -1350,17 +1350,17 @@ pub fn update_process(
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn create_update_message(
|
||||
init_commitment: String,
|
||||
merkle_root_hex: String,
|
||||
process_id: String,
|
||||
state_id: String,
|
||||
) -> ApiResult<ApiReturn> {
|
||||
let mut processes = lock_processes()?;
|
||||
|
||||
let outpoint = OutPoint::from_str(&init_commitment)?;
|
||||
let process_id = OutPoint::from_str(&process_id)?;
|
||||
|
||||
let process = processes.get_mut(&outpoint)
|
||||
let process = processes.get_mut(&process_id)
|
||||
.ok_or(ApiError::new("Unknown process".to_owned()))?;
|
||||
|
||||
let update_state = process.get_state_for_id(&merkle_root_hex)?;
|
||||
let update_state = process.get_state_for_id(&state_id)?;
|
||||
|
||||
// We must have at least the key for the roles field, otherwise we don't know who to send the message to
|
||||
let clear_state = update_state.decrypt_pcd()?;
|
||||
@ -1402,7 +1402,7 @@ pub fn create_update_message(
|
||||
.to_member();
|
||||
|
||||
let full_prd = Prd::new_update(
|
||||
outpoint,
|
||||
process_id,
|
||||
sender,
|
||||
roles,
|
||||
update_state.keys.clone(),
|
||||
@ -1430,10 +1430,6 @@ pub fn create_update_message(
|
||||
}
|
||||
}
|
||||
|
||||
if ciphers.is_empty() {
|
||||
return Err(ApiError::new("Empty ciphers list".to_owned()));
|
||||
}
|
||||
|
||||
Ok(ApiReturn {
|
||||
ciphers_to_send: ciphers,
|
||||
..Default::default()
|
||||
|
Loading…
x
Reference in New Issue
Block a user