Show compressed public key in Debug for CompressedPublicKey

This commit is contained in:
Jiri Jakes 2024-08-31 22:41:12 +08:00
parent c2e3e86106
commit 9db6234ea9
No known key found for this signature in database
GPG Key ID: 01F5B01A5D686F31
1 changed files with 7 additions and 1 deletions

View File

@ -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;