pub struct ControlBlock {
    pub leaf_version: LeafVersion,
    pub output_key_parity: Parity,
    pub internal_key: UntweakedPublicKey,
    pub merkle_branch: TaprootMerkleBranch,
}
Expand description

Control Block data structure used in Tapscript satisfaction

Fields

leaf_version: LeafVersion

The tapleaf version,

output_key_parity: Parity

The parity of the output key (NOT THE INTERNAL KEY WHICH IS ALWAYS XONLY)

internal_key: UntweakedPublicKey

The internal key

merkle_branch: TaprootMerkleBranch

The merkle proof of a script associated with this leaf

Implementations

Obtain a ControlBlock from slice. This is an extra witness element that provides the proof that taproot script pubkey is correctly computed with some specified leaf hash. This is the last element in taproot witness when spending a output via script path.

Errors:
  • If the control block size is not of the form 33 + 32m where 0 <= m <= 128, InvalidControlBlock is returned

Obtain the size of control block. Faster and more efficient than calling serialize() followed by len(). Can be handy for fee estimation

Serialize to a writer. Returns the number of bytes written

Serialize the control block. This would be required when using ControlBlock as a witness element while spending an output via script path. This serialization does not include the VarInt prefix that would be applied when encoding this element as a witness.

Verify that a control block is correct proof for a given output key and script This only checks that script is contained inside the taptree described by output key, full verification must also execute the script with witness data

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize a value from raw data.

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize a value as raw data.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.