pub struct LeafNode { /* private fields */ }Expand description
Store information about taproot leaf node.
Implementations§
source§impl LeafNode
impl LeafNode
sourcepub fn new_script(script: ScriptBuf, ver: LeafVersion) -> Self
pub fn new_script(script: ScriptBuf, ver: LeafVersion) -> Self
Creates an new ScriptLeaf from script and ver and no merkle branch.
Creates an new ScriptLeaf from hash and no merkle branch.
sourcepub fn leaf_hash(&self) -> Option<TapLeafHash>
pub fn leaf_hash(&self) -> Option<TapLeafHash>
Computes a leaf hash for this ScriptLeaf if the leaf is known.
This TapLeafHash is useful while signing taproot script spends.
See LeafNode::node_hash for computing the TapNodeHash which returns the hidden node
hash if the node is hidden.
sourcepub fn node_hash(&self) -> TapNodeHash
pub fn node_hash(&self) -> TapNodeHash
Computes the TapNodeHash for this ScriptLeaf. This returns the
leaf hash if the leaf is known and the hidden node hash if the leaf is
hidden.
See also, LeafNode::leaf_hash.
sourcepub fn script(&self) -> Option<&Script>
pub fn script(&self) -> Option<&Script>
Returns reference to the leaf script if the leaf is known.
sourcepub fn leaf_version(&self) -> Option<LeafVersion>
pub fn leaf_version(&self) -> Option<LeafVersion>
Returns leaf version of the script if the leaf is known.
sourcepub fn merkle_branch(&self) -> &TaprootMerkleBranch
pub fn merkle_branch(&self) -> &TaprootMerkleBranch
Returns reference to the merkle proof (hashing partners) to get this
node in form of TaprootMerkleBranch.
sourcepub fn leaf(&self) -> &TapLeaf
pub fn leaf(&self) -> &TapLeaf
Returns a reference to the leaf of this ScriptLeaf.
Trait Implementations§
source§impl From<&LeafNode> for TapNodeHash
impl From<&LeafNode> for TapNodeHash
source§fn from(leaf: &LeafNode) -> TapNodeHash
fn from(leaf: &LeafNode) -> TapNodeHash
source§impl From<LeafNode> for TapNodeHash
impl From<LeafNode> for TapNodeHash
source§fn from(leaf: LeafNode) -> TapNodeHash
fn from(leaf: LeafNode) -> TapNodeHash
source§impl Ord for LeafNode
impl Ord for LeafNode
source§impl PartialEq<LeafNode> for LeafNode
impl PartialEq<LeafNode> for LeafNode
source§impl PartialOrd<LeafNode> for LeafNode
impl PartialOrd<LeafNode> for LeafNode
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more