[bug] when updating state with values, hash check would have failed if not all values updated
This commit is contained in:
parent
9896532713
commit
3dab6ef2d6
@ -1008,7 +1008,11 @@ pub fn update_process_state(init_commitment: String, state_id: String, hash2valu
|
|||||||
return Err(ApiError::new("State already existing".to_owned()));
|
return Err(ApiError::new("State already existing".to_owned()));
|
||||||
}
|
}
|
||||||
let state_commitments = state.pcd_commitment.to_value_object()?;
|
let state_commitments = state.pcd_commitment.to_value_object()?;
|
||||||
let mut new_encrypted_pcd: Map<String, Value> = Map::with_capacity(hash2values_map.len());
|
let mut new_encrypted_pcd: Map<String, Value> = state_commitments.iter()
|
||||||
|
.map(|(field, _)| {
|
||||||
|
(field.clone(), Value::Null)
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
for (hash, value) in hash2values_map {
|
for (hash, value) in hash2values_map {
|
||||||
// Check the hash in pcd_commitment, get the corresponding field name
|
// Check the hash in pcd_commitment, get the corresponding field name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user