Update to latest common dev

This commit is contained in:
NicolasCantu 2025-01-02 14:22:35 +01:00 committed by Nicolas Cantu
parent b82196e286
commit 855dc4374d

View File

@ -74,7 +74,7 @@ fn handle_initial_transaction(tx: Transaction, commit_msg: &CommitMessage) -> Re
commited_in: root_commitment,
encrypted_pcd: roles_only_map,
pcd_commitment: commit_msg.pcd_commitment.clone(),
merkle_root: merkle_root_bin.to_lower_hex_string(),
state_id: merkle_root_bin.to_lower_hex_string(),
..Default::default()
};
@ -119,10 +119,12 @@ fn register_new_state(commitment: &mut Process, commit_msg: CommitMessage) -> Re
let (empty_state, actual_states) = concurrent_states.split_last().unwrap();
let current_outpoint = empty_state.commited_in;
let new_state_id = commit_msg.pcd_commitment.create_merkle_tree()?.root().unwrap().to_lower_hex_string();
// Ensure no duplicate states
if actual_states
.iter()
.any(|state| state.pcd_commitment == commit_msg.pcd_commitment)
.any(|state| state.state_id == new_state_id)
{
return Err(Error::msg("Proposed state already exists"));
}
@ -133,6 +135,7 @@ fn register_new_state(commitment: &mut Process, commit_msg: CommitMessage) -> Re
commited_in: current_outpoint,
pcd_commitment: commit_msg.pcd_commitment,
encrypted_pcd: roles_only_map,
state_id: new_state_id,
..Default::default()
};
commitment.insert_concurrent_state(new_state)?;