Merge rust-bitcoin/rust-secp256k1#451: Fix getting parity from keypair in fuzzing
f419fe884b
Fix getting parity from keypair in fuzzing (Tim Ruffing) Pull request description: This also enables a test that was failung due to the parity bug. ACKs for top commit: tcharding: ACKf419fe884b
elichai: ACKf419fe884b
apoelstra: ACKf419fe884b
Tree-SHA512: bec00d517495cf010c37079e3d71f1d9547a319aac50cecbca74e6d62eca7188aa79d61ee3d50ef81512c30a31b61b947e2f19e45a95b1b17a1f5cf7cf3f1019
This commit is contained in:
commit
1c4dd0de1e
|
@ -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
|
||||||
|
|
|
@ -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));
|
||||||
|
|
Loading…
Reference in New Issue