Apply suggestions from code review

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
str4d 2020-10-24 12:05:15 +01:00 committed by GitHub
parent 450d68f073
commit 7176ff077c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -8,5 +8,5 @@ and this project adheres to Rust's notion of
## [0.2.1] - 2020-10-24
### Fixed
- `transact::create_to_address` now correctly reconstructs notes from the data
DB after Canopy activation (zcash/librustzcash#311).
DB after Canopy activation (zcash/librustzcash#311). This is critcal to correct
operation of spends after Canopy.

View File

@ -228,18 +228,18 @@ pub fn create_to_address<DB: AsRef<Path>, P: consensus::Parameters>(
let note_value: i64 = row.get(1)?;
let rseed = {
let d: Vec<_> = row.get(2)?;
let rcm_bytes: Vec<_> = row.get(2)?;
// We store rcm directly in the data DB, regardless of whether the note
// used a v1 or v2 note plaintext, so for the purposes of spending let's
// pretend this is a pre-ZIP 212 note.
let r = jubjub::Fr::from_repr(
d[..]
let rcm = jubjub::Fr::from_repr(
rcm_bytes[..]
.try_into()
.map_err(|_| Error(ErrorKind::InvalidNote))?,
)
.ok_or(Error(ErrorKind::InvalidNote))?;
Rseed::BeforeZip212(r)
Rseed::BeforeZip212(rcm)
};
let from = extfvk.fvk.vk.to_payment_address(diversifier).unwrap();