From 58cc5081b250216c067f9d501b1da35aaf690b1d Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Mon, 3 Mar 2025 23:19:10 +0100 Subject: [PATCH] Rename process descriptions to public_data --- src/process.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/process.rs b/src/process.rs index ae41326..918b714 100644 --- a/src/process.rs +++ b/src/process.rs @@ -27,18 +27,13 @@ pub struct ProcessState { pub keys: Map, // We may not always have all the keys pub validation_tokens: Vec, // Signature of the hash of the encrypted pcd tagged with some decision like "yes" or "no" #[tsify(type = "Record")] - pub descriptions: Map, // long descriptions that can be used for the ihm + pub public_data: BTreeMap, // long descriptions that can be used for the ihm #[tsify(type = "Record")] pub roles: BTreeMap, } impl ProcessState { - pub fn new(commited_in: OutPoint, clear_state: Map, descriptions: Map, roles: BTreeMap) -> anyhow::Result { - // Check all descriptions matches clear_state - for (key, _) in &descriptions { - clear_state.get(key).ok_or(anyhow::Error::msg("Missing field in descriptions"))?; - } - + pub fn new(commited_in: OutPoint, clear_state: Map, public_data: &BTreeMap, roles: BTreeMap) -> anyhow::Result { let mut keys = Map::new(); let mut encrypted = Map::new(); @@ -60,7 +55,7 @@ impl ProcessState { encrypted_pcd: Value::Object(encrypted), keys, validation_tokens: vec![], - descriptions, + public_data: public_data.clone(), roles, }; @@ -670,7 +665,7 @@ mod tests { let outpoint = OutPoint::null(); - ProcessState::new(outpoint, clear_pcd.as_object().unwrap().clone(), Map::new(), roles).unwrap() + ProcessState::new(outpoint, clear_pcd.as_object().unwrap().clone(), &BTreeMap::new(), roles).unwrap() } #[test]