pub struct Interpreter<'txin> { /* private fields */ }
Expand description

An iterable Miniscript-structured representation of the spending of a coin

Implementations

Constructs an interpreter from the data of a spending transaction

Accepts a signature-validating function. If you are willing to trust that ECSDA signatures are valid, this can be set to the constant true function; otherwise, it should be a closure containing a sighash and secp context, which can actually verify a given signature.

Creates an iterator over the satisfied spending conditions

Returns all satisfied constraints, even if they were redundant (i.e. did not contribute to the script being satisfied). For example, if a signature were provided for an and_b(Pk,false) fragment, that signature will be returned, even though the entire and_b must have failed and must not have been used.

In case the script is actually dissatisfied, this may return several values before ultimately returning an error.

Running the iterator through will consume the internal stack of the Iterpreter, and it should not be used again after this.

Outputs a “descriptor” string which reproduces the spent coins

This may not represent the original descriptor used to produce the transaction, since it cannot distinguish between sorted and unsorted multisigs (and anyway it can only see the final keys, keyorigin info is lost in serializing to Bitcoin).

If you are using the interpreter as a sanity check on a transaction, it is worthwhile to try to parse this as a descriptor using from_str which will check standardness and consensus limits, which the interpreter does not do on its own. Or use the inferred_descriptor method which does this for you.

Whether this is a pre-segwit spend

Outputs a “descriptor” which reproduces the spent coins

This may not represent the original descriptor used to produce the transaction, since it cannot distinguish between sorted and unsorted multisigs (and anyway it can only see the final keys, keyorigin info is lost in serializing to Bitcoin).

Returns a sighash over the entire transaction which can be used to verify signatures in the descriptor

Not all fields are used by legacy descriptors; if you are sure this is a legacy spend (you can check with the is_legacy method) you can provide dummy data for the amount.

Returns a closure which can be given to the iter method to check all signatures

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 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.