From c82f26e960c8922b757ea492f684f23f7da53dd3 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 23 Jan 2024 16:59:22 +1100 Subject: [PATCH] Use hex-conservative to display pubkey We introduced `hex-conservative` ages ago, use it to display the `PublicKey`. --- bitcoin/src/crypto/key.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs index eb3af41a..fb20eaf8 100644 --- a/bitcoin/src/crypto/key.rs +++ b/bitcoin/src/crypto/key.rs @@ -220,12 +220,8 @@ pub struct SortKey(ArrayVec); impl fmt::Display for PublicKey { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - // TODO: fast hex encoding self.with_serialized(|bytes| { - for ch in bytes { - write!(f, "{:02x}", ch)?; - } - Ok(()) + fmt::Display::fmt(&bytes.as_hex(), f) }) } }