process_validation accepts empty state

This commit is contained in:
NicolasCantu 2025-03-13 14:40:08 +01:00 committed by Nicolas Cantu
parent 6bd8296665
commit 193d49caa7

View File

@ -232,7 +232,14 @@ fn register_new_state(process: &mut Process, commit_msg: &CommitMessage) -> Resu
// Process validation for a state with validation tokens
fn process_validation(updated_process: &mut Process, commit_msg: &CommitMessage) -> Result<OutPoint> {
let new_state_id = commit_msg.pcd_commitment.create_merkle_tree()?.root().ok_or(Error::msg("Invalid merkle tree"))?;
let new_state_id = if commit_msg.pcd_commitment.is_empty() {
// We're dealing with an obliteration attempt
[0u8; 32]
}
else {
commit_msg.pcd_commitment.create_merkle_tree()?.root().ok_or(Error::msg("Invalid merkle tree"))?
};
{
let state_to_update = updated_process
.get_state_for_id_mut(&new_state_id)?;