bitcoin_primitives/
taproot.rs1use hashes::{hash_newtype, sha256t, sha256t_tag};
8
9sha256t_tag! {
11 pub struct TapLeafTag = hash_str("TapLeaf");
12}
13
14hash_newtype! {
15 pub struct TapLeafHash(sha256t::Hash<TapLeafTag>);
19}
20
21sha256t_tag! {
22 pub struct TapBranchTag = hash_str("TapBranch");
23}
24
25hash_newtype! {
26 pub struct TapNodeHash(sha256t::Hash<TapBranchTag>);
30}
31
32sha256t_tag! {
33 pub struct TapTweakTag = hash_str("TapTweak");
34}
35
36hash_newtype! {
37 pub struct TapTweakHash(sha256t::Hash<TapTweakTag>);
41}
42
43impl From<TapLeafHash> for TapNodeHash {
44 fn from(leaf: TapLeafHash) -> TapNodeHash { TapNodeHash::from_byte_array(leaf.to_byte_array()) }
45}