diff --git a/Cargo.toml b/Cargo.toml index c263e88..6675cc3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "grin_secp256k1zkp" -version = "0.7.8" +version = "0.7.9" authors = [ "Grin Developers ", - "Dawid Ciężarkiewicz ", + "Dawid Ciężarkiewicz ", "Andrew Poelstra " ] license = "CC0-1.0" homepage = "https://grin.mw" diff --git a/src/pedersen.rs b/src/pedersen.rs index c4e2a7d..aa7adb4 100644 --- a/src/pedersen.rs +++ b/src/pedersen.rs @@ -98,9 +98,9 @@ impl Commitment { /// Creates from a pubkey pub fn from_pubkey(secp: &Secp256k1, pk: &key::PublicKey) -> Result { unsafe { - let mut commit = Self::blank(); - if ffi::secp256k1_pubkey_to_pedersen_commitment(secp.ctx, commit.as_mut_ptr(), &pk.0) == 1 { - Ok(commit) + let mut commit_i = [0; constants::PEDERSEN_COMMITMENT_SIZE_INTERNAL]; + if ffi::secp256k1_pubkey_to_pedersen_commitment(secp.ctx, commit_i.as_mut_ptr(), &pk.0 as *const _) == 1 { + Ok(secp.commit_ser(commit_i)?) } else { Err(InvalidCommit) }