From 9db6234ea9c9c06ad3eec746463ef6fe989a08aa Mon Sep 17 00:00:00 2001 From: Jiri Jakes Date: Sat, 31 Aug 2024 22:41:12 +0800 Subject: [PATCH] Show compressed public key in Debug for CompressedPublicKey --- bitcoin/src/crypto/key.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs index 38d6aecb0..d38c249d6 100644 --- a/bitcoin/src/crypto/key.rs +++ b/bitcoin/src/crypto/key.rs @@ -271,7 +271,7 @@ impl From<&PublicKey> for PubkeyHash { } /// An always-compressed Bitcoin ECDSA public key. -#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct CompressedPublicKey(pub secp256k1::PublicKey); impl CompressedPublicKey { @@ -350,6 +350,12 @@ impl fmt::Display for CompressedPublicKey { } } +impl fmt::Debug for CompressedPublicKey { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt(format_args!("CompressedPublicKey({})", self)) + } +} + impl FromStr for CompressedPublicKey { type Err = ParseCompressedPublicKeyError;