Skip to content

Commit b028385

Browse files
committed
Improve docs in LeafVersion
1 parent 839c022 commit b028385

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/util/taproot.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,12 @@ pub enum LeafVersion {
771771
}
772772

773773
impl LeafVersion {
774-
/// Obtain LeafVersion from u8, will error when last bit of ver is odd or
775-
/// when ver is 0x50 (ANNEX_TAG)
774+
/// Obtain LeafVersion from consensus byte representation.
775+
///
776+
/// # Errors
777+
/// - If the last bit of the `version` is odd.
778+
/// - If the `version` is 0x50 ([`TAPROOT_ANNEX_PREFIX`]).
779+
/// - If the `version` is not a valid [`LeafVersion`] byte.
776780
// Text from BIP341:
777781
// In order to support some forms of static analysis that rely on
778782
// being able to identify script spends without access to the output being
@@ -791,7 +795,7 @@ impl LeafVersion {
791795
}
792796
}
793797

794-
/// Get the inner version from LeafVersion
798+
/// Get consensus representation of the [`LeafVersion`].
795799
pub fn into_consensus(self) -> u8 {
796800
match self {
797801
LeafVersion::TapScript => TAPROOT_LEAF_TAPSCRIPT,

0 commit comments

Comments
 (0)