[−][src]Enum miniscript::policy::semantic::Policy
Abstract policy which corresponds to the semantics of a Miniscript
and which allows complex forms of analysis, e.g. filtering and
normalization.
Semantic policies store only hashes of keys to ensure that objects
representing the same policy are lifted to the same Semantic
,
regardless of their choice of pk
or pk_h
nodes.
Variants
Unsatisfiable
Trivially satisfiable
KeyHash(Pk::Hash)
Signature and public key matching a given hash is required
After(u32)
A relative locktime restriction
Older(u32)
An absolute locktime restriction
A SHA256 whose preimage must be provided to satisfy the descriptor
A SHA256d whose preimage must be provided to satisfy the descriptor
A RIPEMD160 whose preimage must be provided to satisfy the descriptor
A HASH160 whose preimage must be provided to satisfy the descriptor
A list of sub-policies, all of which must be satisfied
A list of sub-policies, one of which must be satisfied
A set of descriptors, satisfactions must be provided for k
of them
Methods
impl<Pk: MiniscriptKey> Policy<Pk>
[src]
pub fn translate_pkh<Fpkh, Q, E>(
&self,
translatefpkh: Fpkh
) -> Result<Policy<Q>, E> where
Fpkh: FnMut(&Pk::Hash) -> Result<Q::Hash, E>,
Q: MiniscriptKey,
[src]
&self,
translatefpkh: Fpkh
) -> Result<Policy<Q>, E> where
Fpkh: FnMut(&Pk::Hash) -> Result<Q::Hash, E>,
Q: MiniscriptKey,
Convert a policy using one kind of public key to another type of public key
impl<Pk: MiniscriptKey> Policy<Pk>
[src]
pub fn normalized(self) -> Policy<Pk>
[src]
Flatten out trees of And
s and Or
s; eliminate Trivial
and
Unsatisfiable
s. Does not reorder any branches; use .sort
.
pub fn is_trivial(&self) -> bool
[src]
Helper function to detect a true/trivial policy
pub fn is_unsatisfiable(&self) -> bool
[src]
Helper function to detect a false/unsatisfiable policy
pub fn relative_timelocks(&self) -> Vec<u32>
[src]
Returns a list of all relative timelocks, not including 0, which appear in the policy
pub fn at_age(self, time: u32) -> Policy<Pk>
[src]
Filter a policy by eliminating relative timelock constraints that are not satisfied at the given age.
pub fn n_keys(&self) -> usize
[src]
Count the number of public keys and keyhashes referenced in a policy. 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<Pk: MiniscriptKey> Policy<Pk>
[src]
pub fn sorted(self) -> Policy<Pk>
[src]
"Sort" a policy to bring it into a canonical form to allow comparisons. 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<Pk: Clone + MiniscriptKey> Clone for Policy<Pk> where
Pk::Hash: Clone,
[src]
Pk::Hash: Clone,
impl<Pk: MiniscriptKey> Debug for Policy<Pk>
[src]
impl<Pk: MiniscriptKey> Display for Policy<Pk>
[src]
impl<Pk: Eq + MiniscriptKey> Eq for Policy<Pk> where
Pk::Hash: Eq,
[src]
Pk::Hash: Eq,
impl<Pk> FromStr for Policy<Pk> where
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
[src]
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Policy<Pk>, Error>
[src]
impl<Pk> FromTree for Policy<Pk> where
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
[src]
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
impl<Pk: MiniscriptKey> Liftable<Pk> for Semantic<Pk>
[src]
impl<Pk: Ord + MiniscriptKey> Ord for Policy<Pk> where
Pk::Hash: Ord,
[src]
Pk::Hash: Ord,
fn cmp(&self, other: &Policy<Pk>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<Pk: PartialEq + MiniscriptKey> PartialEq<Policy<Pk>> for Policy<Pk> where
Pk::Hash: PartialEq,
[src]
Pk::Hash: PartialEq,
impl<Pk: PartialOrd + MiniscriptKey> PartialOrd<Policy<Pk>> for Policy<Pk> where
Pk::Hash: PartialOrd,
[src]
Pk::Hash: PartialOrd,
fn partial_cmp(&self, other: &Policy<Pk>) -> Option<Ordering>
[src]
fn lt(&self, other: &Policy<Pk>) -> bool
[src]
fn le(&self, other: &Policy<Pk>) -> bool
[src]
fn gt(&self, other: &Policy<Pk>) -> bool
[src]
fn ge(&self, other: &Policy<Pk>) -> bool
[src]
impl<Pk: MiniscriptKey> StructuralEq for Policy<Pk>
[src]
impl<Pk: MiniscriptKey> StructuralPartialEq for Policy<Pk>
[src]
Auto Trait Implementations
impl<Pk> RefUnwindSafe for Policy<Pk> where
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
impl<Pk> Send for Policy<Pk> where
<Pk as MiniscriptKey>::Hash: Send,
<Pk as MiniscriptKey>::Hash: Send,
impl<Pk> Sync for Policy<Pk> where
<Pk as MiniscriptKey>::Hash: Sync,
<Pk as MiniscriptKey>::Hash: Sync,
impl<Pk> Unpin for Policy<Pk> where
<Pk as MiniscriptKey>::Hash: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
impl<Pk> UnwindSafe for Policy<Pk> where
<Pk as MiniscriptKey>::Hash: UnwindSafe,
<Pk as MiniscriptKey>::Hash: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,