pub struct ControlBlock {
pub leaf_version: LeafVersion,
pub output_key_parity: Parity,
pub internal_key: XOnlyPublicKey,
pub merkle_path: Vec<TapNodeHash>,
}Expand description
Control block for script path spending
Fields§
§leaf_version: LeafVersionLeaf version and output key parity (combined in first byte)
output_key_parity: ParityOutput key parity
internal_key: XOnlyPublicKeyInternal key (32 bytes)
merkle_path: Vec<TapNodeHash>Merkle path (32-byte hashes)
Implementations§
Source§impl ControlBlock
impl ControlBlock
Sourcepub fn new(
leaf_version: LeafVersion,
output_key_parity: Parity,
internal_key: XOnlyPublicKey,
merkle_path: Vec<TapNodeHash>,
) -> Self
pub fn new( leaf_version: LeafVersion, output_key_parity: Parity, internal_key: XOnlyPublicKey, merkle_path: Vec<TapNodeHash>, ) -> Self
Create a new control block
Sourcepub fn for_leaf(
tree: &TapTree,
leaf: &TapLeaf,
internal_key: XOnlyPublicKey,
output_key_parity: Parity,
) -> Result<Self, TaprootError>
pub fn for_leaf( tree: &TapTree, leaf: &TapLeaf, internal_key: XOnlyPublicKey, output_key_parity: Parity, ) -> Result<Self, TaprootError>
Create control block for a leaf in a tree
Sourcepub fn from_slice(data: &[u8]) -> Result<Self, TaprootError>
pub fn from_slice(data: &[u8]) -> Result<Self, TaprootError>
Parse from bytes
Sourcepub fn verify(
&self,
output_key: &XOnlyPublicKey,
script: &[u8],
) -> Result<bool, TaprootError>
pub fn verify( &self, output_key: &XOnlyPublicKey, script: &[u8], ) -> Result<bool, TaprootError>
Verify the control block against an output key and script
Trait Implementations§
Source§impl Clone for ControlBlock
impl Clone for ControlBlock
Source§fn clone(&self) -> ControlBlock
fn clone(&self) -> ControlBlock
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ControlBlock
impl Debug for ControlBlock
Source§impl PartialEq for ControlBlock
impl PartialEq for ControlBlock
impl Eq for ControlBlock
impl StructuralPartialEq for ControlBlock
Auto Trait Implementations§
impl Freeze for ControlBlock
impl RefUnwindSafe for ControlBlock
impl Send for ControlBlock
impl Sync for ControlBlock
impl Unpin for ControlBlock
impl UnwindSafe for ControlBlock
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
Mutably borrows from an owned value. Read more