Add up_to_date_roles to UpdatedProcess
This commit is contained in:
parent
f899719cc1
commit
cc8d64f6ce
10
src/api.rs
10
src/api.rs
@ -108,6 +108,7 @@ pub struct UserDiff {
|
||||
pub struct UpdatedProcess {
|
||||
pub commitment_tx: OutPoint,
|
||||
pub current_process: Process,
|
||||
pub up_to_date_roles: HashMap<String, RoleDefinition>,
|
||||
pub new_diffs: Vec<UserDiff>, // All diffs should have the same new_state_merkle_root
|
||||
pub modified_state: Option<String>, // basically when we add/receive validation proofs for a state
|
||||
// I think we should never have both new_state and modified_state
|
||||
@ -878,6 +879,7 @@ fn handle_prd(
|
||||
commitment_tx: outpoint,
|
||||
current_process: relevant_process.clone(),
|
||||
new_diffs: diffs,
|
||||
up_to_date_roles: roles,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
@ -1207,6 +1209,7 @@ pub fn create_new_process(
|
||||
let updated_process = UpdatedProcess {
|
||||
commitment_tx: outpoint,
|
||||
current_process: process,
|
||||
up_to_date_roles: roles,
|
||||
new_diffs: diffs,
|
||||
..Default::default()
|
||||
};
|
||||
@ -1236,9 +1239,11 @@ pub fn update_process(
|
||||
let last_state_commitments = &prev_state.pcd_commitment;
|
||||
let last_state_descriptions = &prev_state.descriptions;
|
||||
|
||||
let clear_new_state = Value::from_str(&new_state_str)?.to_value_object()?;
|
||||
let clear_new_state = Value::from_str(&new_state_str)?;
|
||||
|
||||
let new_state = ProcessState::new(prev_state.commited_in, clear_new_state.clone(), last_state_descriptions.clone())?;
|
||||
let roles = clear_new_state.extract_roles()?;
|
||||
|
||||
let new_state = ProcessState::new(prev_state.commited_in, clear_new_state.to_value_object()?, last_state_descriptions.clone())?;
|
||||
|
||||
// We compare the new state with the previous one
|
||||
let last_state_merkle_root = &prev_state.merkle_root;
|
||||
@ -1261,6 +1266,7 @@ pub fn update_process(
|
||||
let updated_process = UpdatedProcess {
|
||||
commitment_tx: outpoint,
|
||||
current_process: process.clone(),
|
||||
up_to_date_roles: roles,
|
||||
new_diffs: diffs,
|
||||
..Default::default()
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user