Fix y-coordinate recovery in NoteCommit tests

This commit is contained in:
str4d 2021-07-27 09:27:33 +01:00 committed by GitHub
parent 3f506a0129
commit 620e227854
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1584,7 +1584,7 @@ mod tests {
let g_d = self.gd_x.zip(self.gd_y_lsb).map(|(x, y_lsb)| {
// Calculate y = (x^3 + 5).sqrt()
let mut y = (x.square() * x + pallas::Affine::b()).sqrt().unwrap();
if y.is_odd() && y_lsb == pallas::Base::zero() {
if y.is_odd() ^ y_lsb.is_odd() {
y = -y;
}
pallas::Affine::from_xy(x, y).unwrap()
@ -1598,7 +1598,7 @@ mod tests {
let pk_d = self.pkd_x.zip(self.pkd_y_lsb).map(|(x, y_lsb)| {
// Calculate y = (x^3 + 5).sqrt()
let mut y = (x.square() * x + pallas::Affine::b()).sqrt().unwrap();
if y.is_odd() && y_lsb == pallas::Base::zero() {
if y.is_odd() ^ y_lsb.is_odd() {
y = -y;
}
pallas::Affine::from_xy(x, y).unwrap()