Enum sapio_miniscript::policy::concrete::Policy [−][src]
Concrete policy which corresponds directly to a Miniscript structure, and whose disjunctions are annotated with satisfaction probabilities to assist the compiler
Variants
Unsatisfiable
Trivially satisfiable
A public key which must sign to satisfy the descriptor
After(u32)
An absolute locktime restriction
Older(u32)
A relative 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, along with relative probabilities for each one
A set of descriptors, satisfactions must be provided for k
of them
A SHA256 whose must match the tx template
Implementations
impl<Pk: MiniscriptKey> Policy<Pk>
[src]
pub fn translate_pk<Fpk, Q, E>(&self, translatefpk: Fpk) -> Result<Policy<Q>, E> where
Fpk: FnMut(&Pk) -> Result<Q, E>,
Q: MiniscriptKey,
[src]
Fpk: FnMut(&Pk) -> Result<Q, E>,
Q: MiniscriptKey,
Convert a policy using one kind of public key to another type of public key
pub fn keys(&self) -> Vec<&Pk>
[src]
Get all keys in the policy
pub fn check_duplicate_keys(&self) -> Result<(), PolicyError>
[src]
Check whether the policy contains duplicate public keys
pub fn check_timelocks(&self) -> Result<(), PolicyError>
[src]
Checks whether the given concrete policy contains a combination of timelocks and heightlocks. Returns an error if there is at least one satisfaction that contains a combination of hieghtlock and timelock.
pub fn is_valid(&self) -> Result<(), PolicyError>
[src]
This returns whether the given policy is valid or not. It maybe possible that the policy
contains Non-two argument and
, or
or a 0
arg thresh.
Validity condition also checks whether there is a possible satisfaction
combination of timelocks and heightlocks
pub fn is_safe_nonmalleable(&self) -> (bool, bool)
[src]
This returns whether any possible compilation of the policy could be compiled as non-malleable and safe. Note that this returns a tuple (safe, non-malleable) to avoid because the non-malleability depends on safety and we would like to cache results.
Trait Implementations
impl<Pk: Clone + MiniscriptKey> Clone for Policy<Pk>
[src]
impl<Pk: MiniscriptKey> Debug for Policy<Pk>
[src]
impl<Pk: MiniscriptKey> Display for Policy<Pk>
[src]
impl<Pk: Eq + MiniscriptKey> Eq for Policy<Pk>
[src]
impl<Pk: MiniscriptKey> ForEachKey<Pk> for Policy<Pk>
[src]
fn for_each_key<'a, F: FnMut(ForEach<'a, Pk>) -> bool>(
&'a self,
pred: F
) -> bool where
Pk: 'a,
Pk::Hash: 'a,
[src]
&'a self,
pred: F
) -> bool where
Pk: 'a,
Pk::Hash: 'a,
fn for_any_key<'a, F: FnMut(ForEach<'a, Pk>) -> bool>(&'a self, pred: F) -> bool where
Pk: 'a,
Pk::Hash: 'a,
[src]
Pk: 'a,
Pk::Hash: 'a,
impl<Pk> FromStr for Policy<Pk> where
Pk: MiniscriptKey + FromStr,
Pk::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
[src]
Pk: MiniscriptKey + FromStr,
Pk::Hash: FromStr,
<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 + FromStr,
Pk::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
[src]
Pk: MiniscriptKey + FromStr,
Pk::Hash: FromStr,
<Pk as FromStr>::Err: ToString,
impl<Pk: Hash + MiniscriptKey> Hash for Policy<Pk>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<Pk: MiniscriptKey> Liftable<Pk> for Concrete<Pk>
[src]
impl<Pk: Ord + MiniscriptKey> Ord for Policy<Pk>
[src]
fn cmp(&self, other: &Policy<Pk>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<Pk: PartialEq + MiniscriptKey> PartialEq<Policy<Pk>> for Policy<Pk>
[src]
impl<Pk: PartialOrd + MiniscriptKey> PartialOrd<Policy<Pk>> for Policy<Pk>
[src]
fn partial_cmp(&self, other: &Policy<Pk>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[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: RefUnwindSafe,
Pk: RefUnwindSafe,
impl<Pk> Send for Policy<Pk> where
Pk: Send,
Pk: Send,
impl<Pk> Sync for Policy<Pk> where
Pk: Sync,
Pk: Sync,
impl<Pk> Unpin for Policy<Pk> where
Pk: Unpin,
Pk: Unpin,
impl<Pk> UnwindSafe for Policy<Pk> where
Pk: UnwindSafe,
Pk: 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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,