Merge rust-bitcoin/rust-bitcoin#923: Taproot docs nits
da731c4825
Add further description to the NodeInfo struct (Tobin Harding)492ccebd99
Use links for error types (Tobin Harding)3e05887579
Use 'the' to improve sentence (Tobin Harding) Pull request description: See to nits from review of https://github.com/rust-bitcoin/rust-bitcoin/pull/912 Three minor patches to the `taproot` module docs. CC @dr-orlovsky ACKs for top commit: dr-orlovsky: ACKda731c4825
sanket1729: ACKda731c4825
Tree-SHA512: 17a27a19c88f9baa8127023b2ee30fc2259cb0058a92dc9d8ae595e9e02ccb047fefcba7548ff7900fffa7bc6853447183e80660b8756d90d055ab8aa96ae938
This commit is contained in:
commit
efbe1417fe
|
@ -211,7 +211,7 @@ impl TaprootSpendInfo {
|
|||
}
|
||||
|
||||
/// Creates a new key spend with `internal_key` and `merkle_root`. Provide [`None`] for
|
||||
/// `merkle_root` if there is no script path.
|
||||
/// the `merkle_root` if there is no script path.
|
||||
///
|
||||
/// *Note*: As per BIP341
|
||||
///
|
||||
|
@ -521,8 +521,12 @@ impl TaprootBuilder {
|
|||
|
||||
/// Represents the node information in taproot tree.
|
||||
///
|
||||
/// You can use [`TaprootSpendInfo::from_node_info`] to a get [`TaprootSpendInfo`]
|
||||
/// from the merkle root [`NodeInfo`].
|
||||
/// Helper type used in merkle tree construction allowing one to build sparse merkle trees. The node
|
||||
/// represents part of the tree that has information about all of its descendants.
|
||||
/// See how [`TaprootBuilder`] works for more details.
|
||||
///
|
||||
/// You can use [`TaprootSpendInfo::from_node_info`] to a get a [`TaprootSpendInfo`] from the merkle
|
||||
/// root [`NodeInfo`].
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub struct NodeInfo {
|
||||
|
@ -704,11 +708,11 @@ impl ControlBlock {
|
|||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// - `TaprootError::InvalidControlBlockSize` if `sl` is not of size 1 + 32 + 32N for any N >= 0.
|
||||
/// - `TaprootError::InvalidParity` if first byte of `sl` is not a valid output key parity.
|
||||
/// - `TaprootError::InvalidTaprootLeafVersion` if first byte of `sl` is not a valid leaf version.
|
||||
/// - `TaprootError::InvalidInternalKey` if internal key is invalid (first 32 bytes after the parity byte).
|
||||
/// - `TaprootError::InvalidMerkleTreeDepth` if merkle tree is too deep (more than 128 levels).
|
||||
/// - [`TaprootError::InvalidControlBlockSize`] if `sl` is not of size 1 + 32 + 32N for any N >= 0.
|
||||
/// - [`TaprootError::InvalidParity`] if first byte of `sl` is not a valid output key parity.
|
||||
/// - [`TaprootError::InvalidTaprootLeafVersion`] if first byte of `sl` is not a valid leaf version.
|
||||
/// - [`TaprootError::InvalidInternalKey`] if internal key is invalid (first 32 bytes after the parity byte).
|
||||
/// - [`TaprootError::InvalidMerkleTreeDepth`] if merkle tree is too deep (more than 128 levels).
|
||||
pub fn from_slice(sl: &[u8]) -> Result<ControlBlock, TaprootError> {
|
||||
if sl.len() < TAPROOT_CONTROL_BASE_SIZE
|
||||
|| (sl.len() - TAPROOT_CONTROL_BASE_SIZE) % TAPROOT_CONTROL_NODE_SIZE != 0
|
||||
|
|
Loading…
Reference in New Issue