[][src]Enum miniscript::policy::AbstractPolicy

pub enum AbstractPolicy<P> {
    True,
    Key(P),
    Hash(Hash),
    Time(u32),
    Threshold(usizeVec<AbstractPolicy<P>>),
    And(Box<AbstractPolicy<P>>, Box<AbstractPolicy<P>>),
    Or(Box<AbstractPolicy<P>>, Box<AbstractPolicy<P>>),
}

An "abstract" script policy that does not distinguish between functionally equivalent things. Designed to be filterable and analyzable, and to be created from either concrete Policys or even-concreter Miniscripts.

Variants

True

No requirements for satisfaction

Key(P)

A public key which must sign to satisfy the descriptor

Hash(Hash)

A SHA256 whose preimage must be provided to satisfy the descriptor

Time(u32)

A locktime restriction

Threshold(usizeVec<AbstractPolicy<P>>)

A set of descriptors, satisfactions must be provided for k of them

And(Box<AbstractPolicy<P>>, Box<AbstractPolicy<P>>)

A list of descriptors, all of which must be satisfied

Or(Box<AbstractPolicy<P>>, Box<AbstractPolicy<P>>)

A pair of descriptors, one of which must be satisfied

Methods

impl<P> AbstractPolicy<P>[src]

pub fn timelocks(&self) -> Vec<u32>[src]

Returns a list of all timelocks, not including 0, which appear in the policy

pub fn before_time(self, time: u32) -> Option<AbstractPolicy<P>>[src]

Filter an abstract policy by eliminating any timelock constraints. If, after filtering, the policy cannot be satisfied, this function returns None.

pub fn n_keys(&self) -> usize[src]

Count the number of public keys referenced in a policy. Note that duplicate keys will be double-counted.

pub fn minimum_n_keys(&self) -> usize[src]

Count the minimum number of public keys for which signatures could be used to satisfy the policy.

impl<P: Ord> AbstractPolicy<P>[src]

pub fn sort(self) -> AbstractPolicy<P>[src]

"Sort" a policy to bring it into a canonical form to allow comparisons. This does not allow policies to be compared for functional equivalence; in general this appears to require Gröbner basis techniques that are not implemented.

Trait Implementations

impl<P: Eq> Eq for AbstractPolicy<P>[src]

impl<P: Ord> Ord for AbstractPolicy<P>[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

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

Restrict a value to a certain interval. Read more

impl<P: PartialEq> PartialEq<AbstractPolicy<P>> for AbstractPolicy<P>[src]

impl<P: Clone> Clone for AbstractPolicy<P>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<P: PartialOrd> PartialOrd<AbstractPolicy<P>> for AbstractPolicy<P>[src]

impl<P: Debug> Debug for AbstractPolicy<P>[src]

Auto Trait Implementations

impl<P> Send for AbstractPolicy<P> where
    P: Send

impl<P> Sync for AbstractPolicy<P> where
    P: Sync

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]