diff --git a/src/util/taproot.rs b/src/util/taproot.rs index ff8ae5c9..82a20a83 100644 --- a/src/util/taproot.rs +++ b/src/util/taproot.rs @@ -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 { if sl.len() < TAPROOT_CONTROL_BASE_SIZE || (sl.len() - TAPROOT_CONTROL_BASE_SIZE) % TAPROOT_CONTROL_NODE_SIZE != 0