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 PartialOrd for LeafNode
impl PartialOrd for LeafNode
impl Eq for LeafNode
impl StructuralPartialEq for LeafNode
Auto Trait Implementations§
impl Freeze for LeafNode
impl RefUnwindSafe for LeafNode
impl Send for LeafNode
impl Sync for LeafNode
impl Unpin for LeafNode
impl UnwindSafe for LeafNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)