LowerHex and UpperHex implementations for FutureLeafVersion

This commit is contained in:
Dr Maxim Orlovsky 2022-01-09 20:46:51 +01:00
parent 8e9f99b620
commit 7c28b47451
1 changed files with 14 additions and 1 deletions

View File

@ -98,7 +98,6 @@ sha256t_hash_newtype!(TapSighashHash, TapSighashTag, MIDSTATE_TAPSIGHASH, 64,
); );
impl TapTweakHash { impl TapTweakHash {
/// Create a new BIP341 [`TapTweakHash`] from key and tweak /// 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 /// Produces H_taptweak(P||R) where P is internal key and R is the merkle root
pub fn from_key_and_tweak( 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 /// The leaf version for tapleafs
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum LeafVersion { pub enum LeafVersion {