remove PublicKey::combine

This commit is contained in:
Andrew Poelstra 2018-08-15 16:29:23 +00:00
parent fa670a0c2a
commit 17450e91fd
2 changed files with 1 additions and 39 deletions

View File

@ -2,6 +2,7 @@
# [Unreleased]
* Update `rand` to 0.4 and `gcc` 0.3 to `cc` 1.0. (`rand` 0.5 exists but has a lot of breaking changes and no longer compiles with 1.14.0.)
* Remove `PublicKey::combine` from API since it cannot be used with anything else in the API
# 0.10.0 - 2018-07-25

View File

@ -254,21 +254,6 @@ impl PublicKey {
}
}
}
/// Adds a second key to this one, returning the sum. Returns an error if
/// the result would be the point at infinity, i.e. we are adding this point
/// to its own negation
pub fn combine<C>(&self, secp: &Secp256k1<C>, other: &PublicKey) -> Result<PublicKey, Error> {
unsafe {
let mut ret = mem::uninitialized();
let ptrs = [self.as_ptr(), other.as_ptr()];
if ffi::secp256k1_ec_pubkey_combine(secp.ctx, &mut ret, ptrs.as_ptr(), 2) == 1 {
Ok(PublicKey(ret))
} else {
Err(InvalidPublicKey)
}
}
}
}
/// Creates a new public key from a FFI public key
@ -524,30 +509,6 @@ mod test {
assert_eq!(count, COUNT);
}
#[test]
fn pubkey_combine() {
let s = Secp256k1::without_caps();
let compressed1 = PublicKey::from_slice(
&s,
&hex!("0241cc121c419921942add6db6482fb36243faf83317c866d2a28d8c6d7089f7ba"),
).unwrap();
let compressed2 = PublicKey::from_slice(
&s,
&hex!("02e6642fd69bd211f93f7f1f36ca51a26a5290eb2dd1b0d8279a87bb0d480c8443"),
).unwrap();
let exp_sum = PublicKey::from_slice(
&s,
&hex!("0384526253c27c7aef56c7b71a5cd25bebb66dddda437826defc5b2568bde81f07"),
).unwrap();
let sum1 = compressed1.combine(&s, &compressed2);
assert!(sum1.is_ok());
let sum2 = compressed2.combine(&s, &compressed1);
assert!(sum2.is_ok());
assert_eq!(sum1, sum2);
assert_eq!(sum1.unwrap(), exp_sum);
}
#[test]
fn pubkey_equal() {
let s = Secp256k1::new();