From 4be53916b034f924e22566a4a92bf7c74a5aef20 Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Wed, 29 Jan 2025 17:25:36 +0100 Subject: [PATCH] Replace commitment_tx with process_id --- src/prd.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/prd.rs b/src/prd.rs index 18cedb0..b1cce62 100644 --- a/src/prd.rs +++ b/src/prd.rs @@ -57,7 +57,7 @@ impl AnkPrdHash { #[allow(non_camel_case_types)] pub struct Prd { pub prd_type: PrdType, - pub root_commitment: String, + pub process_id: String, pub sender: String, pub keys: Map, // key is a key in pcd, value is the key to decrypt it pub pcd_commitments: Value, @@ -75,7 +75,7 @@ impl Prd { let validation_tokens = if let Some(proof) = previous_proof { vec![proof] } else { vec![] }; Self { prd_type: PrdType::Connect, - root_commitment: String::default(), + process_id: String::default(), pcd_commitments: Value::Null, sender: serde_json::to_string(&sender).unwrap(), validation_tokens, @@ -86,7 +86,7 @@ impl Prd { } pub fn new_update( - root_commitment: OutPoint, + process_id: OutPoint, sender: Member, roles: HashMap, keys: Map, @@ -94,7 +94,7 @@ impl Prd { ) -> Self { Self { prd_type: PrdType::Update, - root_commitment: root_commitment.to_string(), + process_id: process_id.to_string(), sender: serde_json::to_string(&sender).unwrap(), validation_tokens: vec![], keys, @@ -105,14 +105,14 @@ impl Prd { } pub fn new_response( - root_commitment: OutPoint, + process_id: OutPoint, sender: Member, validation_tokens: Vec, pcd_commitments: Value, ) -> Self { Self { prd_type: PrdType::Response, - root_commitment: root_commitment.to_string(), + process_id: process_id.to_string(), sender: serde_json::to_string(&sender).unwrap(), validation_tokens: validation_tokens, keys: Map::new(), @@ -123,13 +123,13 @@ impl Prd { } pub fn new_confirm( - root_commitment: OutPoint, + process_id: OutPoint, sender: Member, pcd_commitments: Value, ) -> Self { Self { prd_type: PrdType::Confirm, - root_commitment: root_commitment.to_string(), + process_id: process_id.to_string(), pcd_commitments, sender: serde_json::to_string(&sender).unwrap(), validation_tokens: vec![], @@ -139,10 +139,10 @@ impl Prd { } } - pub fn new_request(root_commitment: OutPoint, sender: Member, state_ids: Vec<[u8; 32]>) -> Self { + pub fn new_request(process_id: OutPoint, sender: Member, state_ids: Vec<[u8; 32]>) -> Self { Self { prd_type: PrdType::Request, - root_commitment: root_commitment.to_string(), + process_id: process_id.to_string(), sender: serde_json::to_string(&sender).unwrap(), payload: serde_json::to_string(&state_ids).unwrap(), ..Default::default() @@ -183,7 +183,7 @@ impl Prd { } proof.verify()?; } else { - log::warn!("No proof for prd with root_commitment {}", prd.root_commitment); + log::warn!("No proof for prd with process_id {}", prd.process_id); } Ok(prd) }