Refactor handling of prd update
This commit is contained in:
parent
bac3e68400
commit
8d2c34b13b
17
src/api.rs
17
src/api.rs
@ -878,26 +878,13 @@ fn handle_prd(
|
||||
|
||||
let commited_in = relevant_process.get_process_tip()?;
|
||||
|
||||
// Extract the roles from the payload
|
||||
let proposal_roles: BTreeMap<String, RoleDefinition> = serde_json::from_str(&prd.payload)?;
|
||||
|
||||
// TODO: check that the role in the prd has the right commitment
|
||||
|
||||
// TODO: now that roles is not part of the pcd anymore, we need to think of a way to secure it
|
||||
// Take the roles from the last validated state
|
||||
let mut roles = if let Some(last_state) = relevant_process.get_latest_commited_state() {
|
||||
last_state.roles.clone()
|
||||
} else {
|
||||
// We don't have commited state yet, let's take the current roles
|
||||
proposal_roles
|
||||
};
|
||||
|
||||
let new_state = ProcessState {
|
||||
commited_in,
|
||||
pcd_commitment: prd.pcd_commitments,
|
||||
state_id: update_merkle_root.clone(),
|
||||
keys: prd.keys,
|
||||
roles,
|
||||
roles: prd.roles,
|
||||
public_data: prd.public_data,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user