mirror of https://github.com/zcash/orchard.git
Return SpendingKey from Note::dummy
We need the spending keys to create valid spendAuth signatures for Actions containing dummy spent notes.
This commit is contained in:
parent
5ec65c5d2a
commit
52d87e257c
|
@ -180,13 +180,13 @@ mod tests {
|
|||
|
||||
let (circuits, instances): (Vec<_>, Vec<_>) = iter::once(())
|
||||
.map(|()| {
|
||||
let (fvk, spent_note) = Note::dummy(&mut rng, None);
|
||||
let (_, fvk, spent_note) = Note::dummy(&mut rng, None);
|
||||
let nf_old = spent_note.nullifier(&fvk);
|
||||
let ak: SpendValidatingKey = fvk.into();
|
||||
let alpha = pallas::Scalar::random(&mut rng);
|
||||
let rk = ak.randomize(&alpha);
|
||||
|
||||
let (_, output_note) = Note::dummy(&mut rng, Some(nf_old.clone()));
|
||||
let (_, _, output_note) = Note::dummy(&mut rng, Some(nf_old.clone()));
|
||||
let cmx = output_note.commitment().into();
|
||||
|
||||
let value = spent_note.value() - output_note.value();
|
||||
|
|
10
src/note.rs
10
src/note.rs
|
@ -65,8 +65,12 @@ impl Note {
|
|||
/// Defined in [Zcash Protocol Spec § 4.8.3: Dummy Notes (Orchard)][orcharddummynotes].
|
||||
///
|
||||
/// [orcharddummynotes]: https://zips.z.cash/protocol/nu5.pdf#orcharddummynotes
|
||||
pub(crate) fn dummy(rng: &mut impl RngCore, rho: Option<Nullifier>) -> (FullViewingKey, Self) {
|
||||
let fvk: FullViewingKey = (&SpendingKey::random(rng)).into();
|
||||
pub(crate) fn dummy(
|
||||
rng: &mut impl RngCore,
|
||||
rho: Option<Nullifier>,
|
||||
) -> (SpendingKey, FullViewingKey, Self) {
|
||||
let sk = SpendingKey::random(rng);
|
||||
let fvk: FullViewingKey = (&sk).into();
|
||||
let recipient = fvk.default_address();
|
||||
|
||||
let note = Note {
|
||||
|
@ -76,7 +80,7 @@ impl Note {
|
|||
rseed: RandomSeed::random(rng),
|
||||
};
|
||||
|
||||
(fvk, note)
|
||||
(sk, fvk, note)
|
||||
}
|
||||
|
||||
/// Returns the value of this note.
|
||||
|
|
Loading…
Reference in New Issue