forked from rust-bitcoin/rust-bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I don't know what I was thinking when I move the taproot hash types to `primitives`. As correctly pointed out by Kix we agreed to only have blockdata in `primitives`. Move the taproot hash types back to `bitcoin::taproot` and remove the extension traits.
- Loading branch information
Showing
6 changed files
with
97 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +0,0 @@ | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
//! Bitcoin Taproot. | ||
//! | ||
//! This module provides support for Taproot tagged hashes. | ||
use hashes::{hash_newtype, sha256t, sha256t_tag}; | ||
|
||
// Taproot test vectors from BIP-341 state the hashes without any reversing | ||
sha256t_tag! { | ||
pub struct TapLeafTag = hash_str("TapLeaf"); | ||
} | ||
|
||
hash_newtype! { | ||
/// Taproot-tagged hash with tag \"TapLeaf\". | ||
/// | ||
/// This is used for computing tapscript script spend hash. | ||
pub struct TapLeafHash(sha256t::Hash<TapLeafTag>); | ||
} | ||
|
||
hashes::impl_hex_for_newtype!(TapLeafHash); | ||
#[cfg(feature = "serde")] | ||
hashes::impl_serde_for_newtype!(TapLeafHash); | ||
|
||
sha256t_tag! { | ||
pub struct TapBranchTag = hash_str("TapBranch"); | ||
} | ||
|
||
hash_newtype! { | ||
/// Tagged hash used in Taproot trees. | ||
/// | ||
/// See BIP-340 for tagging rules. | ||
pub struct TapNodeHash(sha256t::Hash<TapBranchTag>); | ||
} | ||
|
||
hashes::impl_hex_for_newtype!(TapNodeHash); | ||
#[cfg(feature = "serde")] | ||
hashes::impl_serde_for_newtype!(TapNodeHash); | ||
|
||
sha256t_tag! { | ||
pub struct TapTweakTag = hash_str("TapTweak"); | ||
} | ||
|
||
hash_newtype! { | ||
/// Taproot-tagged hash with tag \"TapTweak\". | ||
/// | ||
/// This hash type is used while computing the tweaked public key. | ||
pub struct TapTweakHash(sha256t::Hash<TapTweakTag>); | ||
} | ||
|
||
hashes::impl_hex_for_newtype!(TapTweakHash); | ||
#[cfg(feature = "serde")] | ||
hashes::impl_serde_for_newtype!(TapTweakHash); | ||
|
||
impl From<TapLeafHash> for TapNodeHash { | ||
fn from(leaf: TapLeafHash) -> TapNodeHash { TapNodeHash::from_byte_array(leaf.to_byte_array()) } | ||
} | ||