Skip to content

Commit 580e89c

Browse files
author
ChallengeDev210
committed
Merge rust-bitcoin/rust-bitcoin#923: Taproot docs nits
da731c4 Add further description to the NodeInfo struct (Tobin Harding) 492cceb Use links for error types (Tobin Harding) 3e05887 Use 'the' to improve sentence (Tobin Harding) Pull request description: See to nits from review of rust-bitcoin/rust-bitcoin#912 Three minor patches to the `taproot` module docs. CC @dr-orlovsky ACKs for top commit: dr-orlovsky: ACK da731c4 sanket1729: ACK da731c4 Tree-SHA512: 17a27a19c88f9baa8127023b2ee30fc2259cb0058a92dc9d8ae595e9e02ccb047fefcba7548ff7900fffa7bc6853447183e80660b8756d90d055ab8aa96ae938
2 parents 597905e + cf83cbf commit 580e89c

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/util/taproot.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl TaprootSpendInfo {
211211
}
212212

213213
/// Creates a new key spend with `internal_key` and `merkle_root`. Provide [`None`] for
214-
/// `merkle_root` if there is no script path.
214+
/// the `merkle_root` if there is no script path.
215215
///
216216
/// *Note*: As per BIP341
217217
///
@@ -521,8 +521,12 @@ impl TaprootBuilder {
521521

522522
/// Represents the node information in taproot tree.
523523
///
524-
/// You can use [`TaprootSpendInfo::from_node_info`] to a get [`TaprootSpendInfo`]
525-
/// from the merkle root [`NodeInfo`].
524+
/// Helper type used in merkle tree construction allowing one to build sparse merkle trees. The node
525+
/// represents part of the tree that has information about all of its descendants.
526+
/// See how [`TaprootBuilder`] works for more details.
527+
///
528+
/// You can use [`TaprootSpendInfo::from_node_info`] to a get a [`TaprootSpendInfo`] from the merkle
529+
/// root [`NodeInfo`].
526530
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
527531
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
528532
pub struct NodeInfo {
@@ -704,11 +708,11 @@ impl ControlBlock {
704708
///
705709
/// # Errors
706710
///
707-
/// - `TaprootError::InvalidControlBlockSize` if `sl` is not of size 1 + 32 + 32N for any N >= 0.
708-
/// - `TaprootError::InvalidParity` if first byte of `sl` is not a valid output key parity.
709-
/// - `TaprootError::InvalidTaprootLeafVersion` if first byte of `sl` is not a valid leaf version.
710-
/// - `TaprootError::InvalidInternalKey` if internal key is invalid (first 32 bytes after the parity byte).
711-
/// - `TaprootError::InvalidMerkleTreeDepth` if merkle tree is too deep (more than 128 levels).
711+
/// - [`TaprootError::InvalidControlBlockSize`] if `sl` is not of size 1 + 32 + 32N for any N >= 0.
712+
/// - [`TaprootError::InvalidParity`] if first byte of `sl` is not a valid output key parity.
713+
/// - [`TaprootError::InvalidTaprootLeafVersion`] if first byte of `sl` is not a valid leaf version.
714+
/// - [`TaprootError::InvalidInternalKey`] if internal key is invalid (first 32 bytes after the parity byte).
715+
/// - [`TaprootError::InvalidMerkleTreeDepth`] if merkle tree is too deep (more than 128 levels).
712716
pub fn from_slice(sl: &[u8]) -> Result<ControlBlock, TaprootError> {
713717
if sl.len() < TAPROOT_CONTROL_BASE_SIZE
714718
|| (sl.len() - TAPROOT_CONTROL_BASE_SIZE) % TAPROOT_CONTROL_NODE_SIZE != 0

0 commit comments

Comments
 (0)