mirror of https://github.com/zcash/orchard.git
Merge pull request #340 from zingolabs/enable_compact_action_and_orchard_domain_creation_without_action
Add OrchardDomain::for_nullifier and CompactAction::from_parts
This commit is contained in:
commit
baabe3d7e2
|
@ -92,6 +92,11 @@ impl OrchardDomain {
|
|||
rho: *act.nullifier(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Constructs a domain from a nullifier.
|
||||
pub fn for_nullifier(nullifier: Nullifier) -> Self {
|
||||
OrchardDomain { rho: nullifier }
|
||||
}
|
||||
}
|
||||
|
||||
impl Domain for OrchardDomain {
|
||||
|
@ -307,6 +312,28 @@ impl ShieldedOutput<OrchardDomain, COMPACT_NOTE_SIZE> for CompactAction {
|
|||
}
|
||||
}
|
||||
|
||||
impl CompactAction {
|
||||
/// Create a CompactAction from its constituent parts
|
||||
pub fn from_parts(
|
||||
nullifier: Nullifier,
|
||||
cmx: ExtractedNoteCommitment,
|
||||
ephemeral_key: EphemeralKeyBytes,
|
||||
enc_ciphertext: [u8; 52],
|
||||
) -> Self {
|
||||
Self {
|
||||
nullifier,
|
||||
cmx,
|
||||
ephemeral_key,
|
||||
enc_ciphertext,
|
||||
}
|
||||
}
|
||||
|
||||
///Returns the nullifier of the note being spent.
|
||||
pub fn nullifier(&self) -> Nullifier {
|
||||
self.nullifier
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use rand::rngs::OsRng;
|
||||
|
|
Loading…
Reference in New Issue