Fix bug in `Builder` initialization of `Circuit` struct

`rcv` was being used correctly outside the circuit to derive `cv_net`
but then `Circuit` was just storing 0. The `round_trip` test passed
because it uses `rcv = 0` everywhere.
This commit is contained in:
Jack Grigg 2021-07-28 22:51:43 +01:00
parent a33d1bd90f
commit 9117273c08
1 changed files with 2 additions and 2 deletions

View File

@ -130,7 +130,7 @@ impl ActionInfo {
/// [orchardsend]: https://zips.z.cash/protocol/nu5.pdf#orchardsend
fn build(self, mut rng: impl RngCore) -> (Action<SigningMetadata>, Circuit) {
let v_net = self.value_sum().expect("already checked this");
let cv_net = ValueCommitment::derive(v_net, self.rcv);
let cv_net = ValueCommitment::derive(v_net, self.rcv.clone());
let nf_old = self.spend.note.nullifier(&self.spend.fvk);
let sender_address = self.spend.fvk.default_address();
@ -196,7 +196,7 @@ impl ActionInfo {
v_new: Some(note.value()),
psi_new: Some(note.rseed().psi(&note.rho())),
rcm_new: Some(note.rseed().rcm(&note.rho())),
rcv: Some(ValueCommitTrapdoor::zero()),
rcv: Some(self.rcv),
},
)
}