From 05a71e2e0c7505a25472afc1021ff34dc241a134 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Tue, 29 Mar 2022 09:49:11 +0200 Subject: [PATCH] Implement ToPublicKey for secp PublicKey --- src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 1d5d1353d..368e72361 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -239,6 +239,16 @@ impl ToPublicKey for bitcoin::PublicKey { } } +impl ToPublicKey for bitcoin::secp256k1::PublicKey { + fn to_public_key(&self) -> bitcoin::PublicKey { + bitcoin::PublicKey::new(*self) + } + + fn hash_to_hash160(hash: &hash160::Hash) -> hash160::Hash { + *hash + } +} + impl ToPublicKey for bitcoin::secp256k1::XOnlyPublicKey { fn to_public_key(&self) -> bitcoin::PublicKey { // This code should never be used.