mirror of https://github.com/zcash/orchard.git
Add a `MerkleHashOrchard::random` function under the `test-dependencies` feature.
This commit is contained in:
parent
1db974141b
commit
7ef1feaf16
16
src/tree.rs
16
src/tree.rs
|
@ -260,6 +260,22 @@ impl<'de> Deserialize<'de> for MerkleHashOrchard {
|
|||
}
|
||||
}
|
||||
|
||||
/// Test utilities available under the `test-dependencies` feature flag.
|
||||
#[cfg(feature = "test-dependencies")]
|
||||
pub mod testing {
|
||||
use ff::Field;
|
||||
use rand::RngCore;
|
||||
|
||||
use super::MerkleHashOrchard;
|
||||
|
||||
impl MerkleHashOrchard {
|
||||
/// Return a random fake `MerkleHashOrchard`.
|
||||
pub fn random(rng: &mut impl RngCore) -> Self {
|
||||
Self(pasta_curves::Fp::random(rng))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use {
|
||||
|
|
Loading…
Reference in New Issue