Struct miniscript::plan::Assets

source ·
pub struct Assets {
    pub keys: BTreeSet<(KeySource, CanSign)>,
    pub sha256_preimages: BTreeSet<Hash>,
    pub hash256_preimages: BTreeSet<Hash>,
    pub ripemd160_preimages: BTreeSet<Hash>,
    pub hash160_preimages: BTreeSet<Hash>,
    pub absolute_timelock: Option<LockTime>,
    pub relative_timelock: Option<Sequence>,
}
Expand description

The Assets we can use to satisfy a particular spending path

Fields§

§keys: BTreeSet<(KeySource, CanSign)>

Keys the user can sign for, and how. A pair (fingerprint, derivation_path) is provided, meaning that the user can sign using the key with fingerprint, derived with either derivation_path or a derivation path that extends derivation_path by exactly one child number. For example, if the derivation path m/0/1 is provided, the user can sign with either m/0/1 or m/0/1/*.

§sha256_preimages: BTreeSet<Hash>

Set of available sha256 preimages

§hash256_preimages: BTreeSet<Hash>

Set of available hash256 preimages

§ripemd160_preimages: BTreeSet<Hash>

Set of available ripemd160 preimages

§hash160_preimages: BTreeSet<Hash>

Set of available hash160 preimages

§absolute_timelock: Option<LockTime>

Maximum absolute timelock allowed

§relative_timelock: Option<Sequence>

Maximum relative timelock allowed

Implementations§

source§

impl Assets

source

pub fn new() -> Self

Contruct an empty instance

source

pub fn add<A: IntoAssets>(self, asset: A) -> Self

Add some assets

source

pub fn older(self, seq: Sequence) -> Self

Set the maximum relative timelock allowed

source

pub fn after(self, lt: LockTime) -> Self

Set the maximum absolute timelock allowed

Trait Implementations§

source§

impl AssetProvider<DefiniteDescriptorKey> for Assets

source§

fn provider_lookup_ecdsa_sig(&self, pk: &DefiniteDescriptorKey) -> bool

Given a public key, look up an ECDSA signature with that key, return whether we found it
source§

fn provider_lookup_tap_key_spend_sig( &self, pk: &DefiniteDescriptorKey ) -> Option<usize>

Lookup the tap key spend sig and return its size
source§

fn provider_lookup_tap_leaf_script_sig( &self, pk: &DefiniteDescriptorKey, tap_leaf_hash: &TapLeafHash ) -> Option<usize>

Given a public key and a associated leaf hash, look up a schnorr signature with that key and return its size
source§

fn provider_lookup_sha256(&self, hash: &Hash) -> bool

Given a SHA256 hash, look up its preimage, return whether we found it
source§

fn provider_lookup_hash256(&self, hash: &Hash) -> bool

Given a HASH256 hash, look up its preimage, return whether we found it
source§

fn provider_lookup_ripemd160(&self, hash: &Hash) -> bool

Given a RIPEMD160 hash, look up its preimage, return whether we found it
source§

fn provider_lookup_hash160(&self, hash: &Hash) -> bool

Given a HASH160 hash, look up its preimage, return whether we found it
source§

fn check_older(&self, s: Sequence) -> bool

Assert whether a relative locktime is satisfied
source§

fn check_after(&self, l: LockTime) -> bool

Assert whether an absolute locktime is satisfied
source§

fn provider_lookup_tap_control_block_map( &self ) -> Option<&BTreeMap<ControlBlock, (ScriptBuf, LeafVersion)>>

Obtain a reference to the control block for a ver and script
source§

fn provider_lookup_raw_pkh_pk(&self, _: &Hash) -> Option<PublicKey>

Given a raw Pkh, lookup corresponding bitcoin::PublicKey
source§

fn provider_lookup_raw_pkh_x_only_pk(&self, _: &Hash) -> Option<XOnlyPublicKey>

Given a raw Pkh, lookup corresponding [bitcoin::secp256k1::XOnlyPublicKey]
source§

fn provider_lookup_raw_pkh_ecdsa_sig(&self, _: &Hash) -> Option<PublicKey>

Given a keyhash, look up the EC signature and the associated key. Returns the key if a signature is found. Even if signatures for public key Hashes are not available, the users can use this map to provide pkh -> pk mapping which can be useful for dissatisfying pkh.
source§

fn provider_lookup_raw_pkh_tap_leaf_script_sig( &self, _: &(Hash, TapLeafHash) ) -> Option<(XOnlyPublicKey, usize)>

Given a keyhash, look up the schnorr signature and the associated key. Returns the key and sig len if a signature is found. Even if signatures for public key Hashes are not available, the users can use this map to provide pkh -> pk mapping which can be useful for dissatisfying pkh.
source§

impl Debug for Assets

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Assets

source§

fn default() -> Assets

Returns the “default value” for a type. Read more
source§

impl FromIterator<DescriptorPublicKey> for Assets

source§

fn from_iter<I: IntoIterator<Item = DescriptorPublicKey>>(iter: I) -> Self

Creates a value from an iterator. Read more
source§

impl IntoAssets for Assets

source§

fn into_assets(self) -> Assets

Convert self into a Assets struct

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V