From 7c28b474516c60df18d57f47aea83bb8431def2c Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sun, 9 Jan 2022 20:46:51 +0100 Subject: [PATCH] LowerHex and UpperHex implementations for FutureLeafVersion --- src/util/taproot.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/util/taproot.rs b/src/util/taproot.rs index 9a1043e7..691b25b6 100644 --- a/src/util/taproot.rs +++ b/src/util/taproot.rs @@ -98,7 +98,6 @@ sha256t_hash_newtype!(TapSighashHash, TapSighashTag, MIDSTATE_TAPSIGHASH, 64, ); impl TapTweakHash { - /// Create a new BIP341 [`TapTweakHash`] from key and tweak /// Produces H_taptweak(P||R) where P is internal key and R is the merkle root pub fn from_key_and_tweak( @@ -791,6 +790,20 @@ impl fmt::Display for FutureLeafVersion { } } +impl fmt::LowerHex for FutureLeafVersion { + #[inline] + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::LowerHex::fmt(&self.0, f) + } +} + +impl fmt::UpperHex for FutureLeafVersion { + #[inline] + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::UpperHex::fmt(&self.0, f) + } +} + /// The leaf version for tapleafs #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum LeafVersion {