mirror of https://github.com/zcash/orchard.git
Re-introduce `ValueSum::from_raw` as a `pub(crate)` method
We removed this in zcash/orchard#267 as it did not need to be part of the public API, but we do still need a way to convert the user-defined valueBalance type into a `ValueSum` when constructing `bvk`, and this method is preferable to exposing the `ValueSum` internals.
This commit is contained in:
parent
17ad25ee35
commit
b1d7787ab6
10
src/value.rs
10
src/value.rs
|
@ -140,6 +140,16 @@ impl ValueSum {
|
|||
// Default for i64 is zero.
|
||||
Default::default()
|
||||
}
|
||||
|
||||
/// Creates a value sum from its raw numeric value.
|
||||
///
|
||||
/// This only enforces that the value is a signed 63-bit integer. We use it internally
|
||||
/// in `Bundle::binding_validating_key`, where we are converting from the user-defined
|
||||
/// `valueBalance` type that enforces any additional constraints on the value's valid
|
||||
/// range.
|
||||
pub(crate) fn from_raw(value: i64) -> Self {
|
||||
ValueSum(value as i128)
|
||||
}
|
||||
}
|
||||
|
||||
impl Add for ValueSum {
|
||||
|
|
Loading…
Reference in New Issue