From d9900844816c9742b259313b9379c89fc2bd15af Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Tue, 6 Jun 2023 20:24:28 +0100 Subject: [PATCH 1/2] key: Implement From for XOnlyPublicKey --- bitcoin/src/crypto/key.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs index 2425d6f8..3a13ae25 100644 --- a/bitcoin/src/crypto/key.rs +++ b/bitcoin/src/crypto/key.rs @@ -253,6 +253,12 @@ impl PublicKey { } } +impl From for XOnlyPublicKey { + fn from(pk: PublicKey) -> XOnlyPublicKey { + pk.inner.into() + } +} + /// An opaque return type for PublicKey::to_sort_key #[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] pub struct SortKey(u8, [u8; 32], [u8; 32]); From 445aa84f8ce0c434a1485a77496900fd7560734c Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Mon, 12 Jun 2023 13:01:12 +0000 Subject: [PATCH 2/2] cargo fmt --- bitcoin/src/crypto/key.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs index 3a13ae25..011bbae4 100644 --- a/bitcoin/src/crypto/key.rs +++ b/bitcoin/src/crypto/key.rs @@ -254,9 +254,7 @@ impl PublicKey { } impl From for XOnlyPublicKey { - fn from(pk: PublicKey) -> XOnlyPublicKey { - pk.inner.into() - } + fn from(pk: PublicKey) -> XOnlyPublicKey { pk.inner.into() } } /// An opaque return type for PublicKey::to_sort_key