Trait TapScriptClause

Source
pub trait TapScriptClause: Sized + Clone {
    type WitnessData;

    // Required methods
    fn tapscript(&self) -> ScriptBuf;
    fn witness_size(&self, vtxo: &Vtxo) -> usize;
    fn witness(
        &self,
        data: &Self::WitnessData,
        control_block: &ControlBlock,
    ) -> Witness;

    // Provided method
    fn control_block(&self, vtxo: &Vtxo) -> ControlBlock { ... }
}
Expand description

A trait describing a VTXO policy clause.

It can be used when creating the VTXO, specifying the script pubkey, and check the satisfaction weight when spending it.

Required Associated Types§

Source

type WitnessData

The type of witness data required to sign the clause.

Required Methods§

Source

fn tapscript(&self) -> ScriptBuf

Returns the tapscript for the clause.

Source

fn witness_size(&self, vtxo: &Vtxo) -> usize

Computes the total witness size in bytes for spending via this clause.

Source

fn witness( &self, data: &Self::WitnessData, control_block: &ControlBlock, ) -> Witness

Constructs the witness for the clause.

Provided Methods§

Source

fn control_block(&self, vtxo: &Vtxo) -> ControlBlock

Construct the taproot control block for spending the VTXO using this clause

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§