clementine_core::builder::script

Trait SpendableScript

Source
pub trait SpendableScript:
    Send
    + Sync
    + 'static
    + Any {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn kind(&self) -> ScriptKind<'_>;
    fn to_script_buf(&self) -> ScriptBuf;
}
Expand description

A trait that marks all script types. Each script has a generate_script_inputs (eg. WinternitzCommit::generate_script_inputs) function that generates the witness for the script using various arguments. A dyn SpendableScript is cast into a concrete ScriptKind to generate a witness, the trait object can be used to generate the script_buf.

We store [Arc<dyn SpendableScript>]s inside a super::transaction::TxHandler input, and we cast them into a ScriptKind when signing.

When creating a new Script, make sure you add it to the ScriptKind enum and add a test for it below. Otherwise, it will not be spendable.

Required Methods§

Source

fn as_any(&self) -> &dyn Any

Source

fn kind(&self) -> ScriptKind<'_>

Source

fn to_script_buf(&self) -> ScriptBuf

Trait Implementations§

Source§

impl Debug for dyn SpendableScript

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§