mirror of https://github.com/zcash/orchard.git
Add a `Bundle::binding_validating_key` method
This derives the `bvk` for validating `Authorized::binding_signature`.
This commit is contained in:
parent
ee26116fcf
commit
eec17a9174
|
@ -7,7 +7,7 @@ use crate::{
|
||||||
note::{ExtractedNoteCommitment, Nullifier, TransmittedNoteCiphertext},
|
note::{ExtractedNoteCommitment, Nullifier, TransmittedNoteCiphertext},
|
||||||
primitives::redpallas::{self, Binding, SpendAuth},
|
primitives::redpallas::{self, Binding, SpendAuth},
|
||||||
tree::Anchor,
|
tree::Anchor,
|
||||||
value::ValueCommitment,
|
value::{ValueCommitTrapdoor, ValueCommitment, ValueSum},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// An action applied to the global ledger.
|
/// An action applied to the global ledger.
|
||||||
|
@ -300,6 +300,22 @@ impl<T: Authorization, V> Bundle<T, V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: Authorization, V: Copy + Into<ValueSum>> Bundle<T, V> {
|
||||||
|
/// Returns the transaction binding validating key for this bundle.
|
||||||
|
///
|
||||||
|
/// This can be used to validate the [`Authorized::binding_signature`] returned from
|
||||||
|
/// [`Bundle::authorization`].
|
||||||
|
pub fn binding_validating_key(&self) -> redpallas::VerificationKey<Binding> {
|
||||||
|
(self
|
||||||
|
.actions
|
||||||
|
.iter()
|
||||||
|
.map(|a| a.cv_net())
|
||||||
|
.sum::<ValueCommitment>()
|
||||||
|
- ValueCommitment::derive(self.value_balance.into(), ValueCommitTrapdoor::zero()))
|
||||||
|
.into_bvk()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Authorizing data for a bundle of actions, ready to be committed to the ledger.
|
/// Authorizing data for a bundle of actions, ready to be committed to the ledger.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Authorized {
|
pub struct Authorized {
|
||||||
|
|
Loading…
Reference in New Issue