Fix getting parity from keypair in fuzzing

This also enables a test that was failung due to the parity bug.
This commit is contained in:
Tim Ruffing 2022-06-14 10:27:33 +02:00
parent aba2663bc8
commit f419fe884b
2 changed files with 1 additions and 3 deletions

View File

@ -1169,7 +1169,7 @@ mod fuzz_dummy {
) -> c_int { ) -> c_int {
check_context_flags(cx, 0); check_context_flags(cx, 0);
if !pk_parity.is_null() { if !pk_parity.is_null() {
*pk_parity = ((*keypair).0[32] == 0).into(); *pk_parity = ((*keypair).0[64] == 0).into();
} }
(*pubkey).0.copy_from_slice(&(*keypair).0[32..]); (*pubkey).0.copy_from_slice(&(*keypair).0[32..]);
1 1

View File

@ -2180,8 +2180,6 @@ mod test {
let (want_tweaked_xonly, tweaked_kp_parity) = XOnlyPublicKey::from_keypair(&tweaked_kp); let (want_tweaked_xonly, tweaked_kp_parity) = XOnlyPublicKey::from_keypair(&tweaked_kp);
assert_eq!(tweaked_xonly, want_tweaked_xonly); assert_eq!(tweaked_xonly, want_tweaked_xonly);
#[cfg(not(fuzzing))]
assert_eq!(parity, tweaked_kp_parity); assert_eq!(parity, tweaked_kp_parity);
assert!(xonly.tweak_add_check(&s, &tweaked_xonly, parity, tweak)); assert!(xonly.tweak_add_check(&s, &tweaked_xonly, parity, tweak));