Make tweak_add_assign return statements uniform
We have two `tweak_add_assign` methods (one for keypair and one for x-only pubkey). Both check the return value from a FFI function call. We can make both sites uniform to _slightly_ reduce cognitive load when reading the code. Use C style code to make it obvious to readers that this is basically C code.
This commit is contained in:
parent
edafb88f8c
commit
1b768b2749
10
src/key.rs
10
src/key.rs
|
@ -636,12 +636,11 @@ impl KeyPair {
|
||||||
&mut self.0,
|
&mut self.0,
|
||||||
tweak.as_c_ptr(),
|
tweak.as_c_ptr(),
|
||||||
);
|
);
|
||||||
|
if err != 1 {
|
||||||
if err == 1 {
|
return Err(Error::InvalidTweak);
|
||||||
Ok(())
|
|
||||||
} else {
|
|
||||||
Err(Error::InvalidTweak)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -846,7 +845,6 @@ impl XOnlyPublicKey {
|
||||||
self.as_c_ptr(),
|
self.as_c_ptr(),
|
||||||
tweak.as_c_ptr(),
|
tweak.as_c_ptr(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if err != 1 {
|
if err != 1 {
|
||||||
return Err(Error::InvalidTweak);
|
return Err(Error::InvalidTweak);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue