diff --git a/src/pcd.rs b/src/pcd.rs index 54f3a50..33a6415 100644 --- a/src/pcd.rs +++ b/src/pcd.rs @@ -94,7 +94,7 @@ impl AnkPcdHash { } pub trait Pcd<'a>: Serialize + Deserialize<'a> { - fn from_string(str: &str) -> Result { + fn new_from_string(str: &str) -> Result { let value: Value = serde_json::from_str(str)?; match value { @@ -103,10 +103,10 @@ pub trait Pcd<'a>: Serialize + Deserialize<'a> { } } - fn hash_fields(&self, root_commitment: OutPoint) -> Result> { + fn hash_all_fields(&self, commited_in: OutPoint) -> Result> { let map = self.to_value_object()?; - let outpoint = serialize(&root_commitment); + let outpoint = serialize(&commited_in); let mut field2hash = Map::with_capacity(map.len()); // this could be optimised since there's a midstate we're reusing @@ -118,7 +118,7 @@ pub trait Pcd<'a>: Serialize + Deserialize<'a> { Ok(field2hash) } - /// We run this on the result of `hash_fields` + /// We run this on the result of `hash_all_fields` fn create_merkle_tree(&self) -> Result> { let map = self.to_value_object()?; let leaves: Result> = map @@ -186,8 +186,9 @@ pub trait Pcd<'a>: Serialize + Deserialize<'a> { Ok(()) } - fn decrypt_fields( + fn decrypt_all( &self, + commited_in: OutPoint, fields2commit: &Map, fields2keys: &Map, fields2plain: &mut Map,