Update process when commiting new state

This commit is contained in:
NicolasCantu 2025-01-17 18:15:57 +01:00
parent 04b9785531
commit eea95b8342

View File

@ -279,7 +279,7 @@ fn commit_new_transaction(
return Err(Error::msg(format!("Missing next commitment outpoint for process {}", updated_process.get_process_id()?))); return Err(Error::msg(format!("Missing next commitment outpoint for process {}", updated_process.get_process_id()?)));
}; };
let commitment_payload = Vec::from_hex(state_to_commit.state_id)?; let commitment_payload = Vec::from_hex(state_to_commit.state_id.clone())?;
let psbt = create_transaction( let psbt = create_transaction(
vec![mandatory_input], vec![mandatory_input],
@ -297,6 +297,8 @@ fn commit_new_transaction(
let commited_in = OutPoint::new(txid, 0); let commited_in = OutPoint::new(txid, 0);
freezed_utxos.insert(commited_in); freezed_utxos.insert(commited_in);
updated_process.remove_all_concurrent_states()?;
updated_process.insert_concurrent_state(state_to_commit)?;
updated_process.update_states_tip(commited_in)?; updated_process.update_states_tip(commited_in)?;
Ok(commited_in) Ok(commited_in)