pub struct LeafNode { /* private fields */ }
Expand description
Store information about taproot leaf node.
Implementations§
§impl LeafNode
impl LeafNode
pub fn new_script(script: ScriptBuf, ver: LeafVersion) -> LeafNode
pub fn new_script(script: ScriptBuf, ver: LeafVersion) -> LeafNode
Creates an new ScriptLeaf
from script
and ver
and no merkle branch.
Creates an new ScriptLeaf
from hash
and no merkle branch.
pub 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.
pub 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
.
pub fn leaf_version(&self) -> Option<LeafVersion>
pub fn leaf_version(&self) -> Option<LeafVersion>
Returns leaf version of the script if the leaf is known.
pub 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
.
pub fn leaf(&self) -> &TapLeaf
pub fn leaf(&self) -> &TapLeaf
Returns a reference to the leaf of this ScriptLeaf
.
Trait Implementations§
§impl From<&LeafNode> for TapNodeHash
impl From<&LeafNode> for TapNodeHash
§fn from(leaf: &LeafNode) -> TapNodeHash
fn from(leaf: &LeafNode) -> TapNodeHash
§impl From<LeafNode> for TapNodeHash
impl From<LeafNode> for TapNodeHash
§fn from(leaf: LeafNode) -> TapNodeHash
fn from(leaf: LeafNode) -> TapNodeHash
§impl Ord for LeafNode
impl Ord for LeafNode
§impl PartialOrd for LeafNode
impl PartialOrd for LeafNode
§fn partial_cmp(&self, other: &LeafNode) -> Option<Ordering>
fn partial_cmp(&self, other: &LeafNode) -> Option<Ordering>
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