Skip to content

Commit

Permalink
move lazy static out of method
Browse files Browse the repository at this point in the history
  • Loading branch information
oxarbitrage committed Jul 20, 2022
1 parent f79c438 commit 4cbe1fc
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions zebra-chain/src/orchard/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,17 +301,16 @@ impl ValueCommitment {
/// <https://zips.z.cash/protocol/nu5.pdf#concretehomomorphiccommit>
#[allow(non_snake_case)]
pub fn new(rcv: pallas::Scalar, value: Amount) -> Self {
lazy_static! {
static ref V: pallas::Point = pallas_group_hash(b"z.cash:Orchard-cv", b"v");
static ref R: pallas::Point = pallas_group_hash(b"z.cash:Orchard-cv", b"r");
}

let v = pallas::Scalar::from(value);

Self::from(*V * v + *R * rcv)
}
}

lazy_static! {
static ref V: pallas::Point = pallas_group_hash(b"z.cash:Orchard-cv", b"v");
static ref R: pallas::Point = pallas_group_hash(b"z.cash:Orchard-cv", b"r");
}

#[cfg(test)]
mod tests {

Expand Down

0 comments on commit 4cbe1fc

Please sign in to comment.