Let the compiler work out int size
We have two places in the code where we pass a mutable parity integer to ffi code. At one callsite we tell the compiler explicitly what type it is (`::secp256k1_sys::types::c_int`) and at the other call site we let the compiler figure out the type. Is one way better than the other? I don't know. But letting the compiler figure it out seems to make the code easier to read.
This commit is contained in:
parent
c612130864
commit
b4c7fa0d4e
|
@ -1111,6 +1111,7 @@ impl XOnlyPublicKey {
|
|||
return Err(Error::InvalidTweak);
|
||||
}
|
||||
|
||||
let mut pk_parity = 0;
|
||||
unsafe {
|
||||
let mut pubkey = ffi::PublicKey::new();
|
||||
let mut err = ffi::secp256k1_xonly_pubkey_tweak_add(
|
||||
|
@ -1123,18 +1124,17 @@ impl XOnlyPublicKey {
|
|||
return Err(Error::InvalidTweak);
|
||||
}
|
||||
|
||||
let mut parity: ::secp256k1_sys::types::c_int = 0;
|
||||
err = ffi::secp256k1_xonly_pubkey_from_pubkey(
|
||||
secp.ctx,
|
||||
&mut self.0,
|
||||
&mut parity,
|
||||
&mut pk_parity,
|
||||
&pubkey,
|
||||
);
|
||||
if err == 0 {
|
||||
return Err(Error::InvalidPublicKey);
|
||||
}
|
||||
|
||||
Parity::from_i32(parity).map_err(Into::into)
|
||||
Parity::from_i32(pk_parity).map_err(Into::into)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue