Replace commitment_tx with process_id
This commit is contained in:
parent
d55cba4d9f
commit
56e7025288
22
src/prd.rs
22
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<String, Value>, // 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<String, RoleDefinition>,
|
||||
keys: Map<String, Value>,
|
||||
@ -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<Proof>,
|
||||
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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user