Struct LegacyCSFSCov

Source
pub struct LegacyCSFSCov<Pk: MiniscriptKey, Ext: Extension> { /* private fields */ }
Expand description

The covenant descriptor

Implementations§

Source§

impl<Pk: MiniscriptKey, Ext: Extension> LegacyCSFSCov<Pk, Ext>

Source

pub fn pk(&self) -> &Pk

Get the pk from covenant

Source

pub fn to_ms(&self) -> &Miniscript<Pk, Segwitv0, Ext>

Get a reference to Miniscript inside covenant

Source

pub fn into_ms(self) -> Miniscript<Pk, Segwitv0, Ext>

Consume self and return inner miniscript

Source

pub fn new(pk: Pk, ms: Miniscript<Pk, Segwitv0, Ext>) -> Result<Self, Error>

Create a new Self from components

Source

pub fn encode(&self) -> Script
where Pk: ToPublicKey, Ext: ParseableExt,

Encode

Source

pub fn satisfy<S: Satisfier<Pk>>( &self, s: S, allow_mall: bool, ) -> Result<Vec<Vec<u8>>, Error>
where Pk: ToPublicKey, Ext: ParseableExt,

Create a satisfaction for the Covenant Descriptor

Source

pub fn cov_script_code(&self) -> Script
where Pk: ToPublicKey,

Script code for signing with covenant publickey. Use this script_code for sighash method when signing with the covenant pk.

Source§

impl<Ext: ParseableExt> LegacyCSFSCov<PublicKey, Ext>

Source

pub fn parse_insane(script: &Script) -> Result<Self, Error>

Parse a descriptor from script. While parsing other descriptors, we only parse the inner miniscript with ScriptContext. But Covenant descriptors only applicable under Wsh context to avoid implementation complexity.

Source

pub fn parse(script: &Script) -> Result<Self, Error>

Parse a descriptor with additional local sanity checks. See Miniscript::sanity_check for all the checks. Use Miniscript::parse_insane to allow parsing insane scripts

Source§

impl<Pk, Ext> LegacyCSFSCov<Pk, Ext>
where Pk: MiniscriptKey, Ext: Extension,

Source

pub fn sanity_check(&self) -> Result<(), Error>

Sanity checks for this covenant descriptor

Source

pub fn address( &self, blinder: Option<PublicKey>, params: &'static AddressParams, ) -> Address
where Pk: ToPublicKey, Ext: ParseableExt,

Obtains the blinded address for this descriptor.

Source

pub fn script_pubkey(&self) -> Script
where Pk: ToPublicKey, Ext: ParseableExt,

Obtains the script pubkey for this descriptor.

Source

pub fn unsigned_script_sig(&self) -> Script
where Pk: ToPublicKey,

Computes the scriptSig that will be in place for an unsigned input spending an output with this descriptor.

Source

pub fn inner_script(&self) -> Script
where Pk: ToPublicKey, Ext: ParseableExt,

Computes the the underlying script before any hashing is done.

Source

pub fn get_satisfaction<S>( &self, satisfier: S, ) -> Result<(Vec<Vec<u8>>, Script), Error>
where Pk: ToPublicKey, S: Satisfier<Pk>, Ext: ParseableExt,

Returns satisfying non-malleable witness and scriptSig to spend an output controlled by the given descriptor if it possible to construct one using the satisfier S.

Source

pub fn max_satisfaction_weight(&self) -> Result<usize, Error>

Computes an upper bound on the weight of a satisfying witness to the transaction.

Source

pub fn ecdsa_sighash_script_code(&self) -> Script
where Pk: ToPublicKey, Ext: ParseableExt,

This returns the entire explicit script as the script code. You will need this script code when singing with pks that inside Miniscript. Use the Self::cov_script_code method to get the script code for signing with covenant pk

Source

pub fn get_satisfaction_mall<S>( &self, satisfier: S, ) -> Result<(Vec<Vec<u8>>, Script), Error>
where Pk: ToPublicKey, S: Satisfier<Pk>, Ext: ParseableExt,

Returns a possilbly mallable satisfying non-malleable witness and scriptSig to spend an output controlled by the given descriptor if it possible to construct one using the satisfier S.

Trait Implementations§

Source§

impl<Pk: Clone + MiniscriptKey, Ext: Clone + Extension> Clone for LegacyCSFSCov<Pk, Ext>

Source§

fn clone(&self) -> LegacyCSFSCov<Pk, Ext>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Pk, Ext> Debug for LegacyCSFSCov<Pk, Ext>
where Pk: MiniscriptKey, Ext: Extension,

Source§

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

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

impl<Pk, Ext> Display for LegacyCSFSCov<Pk, Ext>
where Pk: MiniscriptKey, Ext: Extension,

Source§

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

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

impl<Pk: MiniscriptKey, Ext: Extension> ForEachKey<Pk> for LegacyCSFSCov<Pk, Ext>

Source§

fn for_each_key<'a, F: FnMut(&'a Pk) -> bool>(&'a self, pred: F) -> bool
where Pk: 'a,

Run a predicate on every key in the descriptor, returning whether the predicate returned true for every key
Source§

fn for_any_key<'a, F>(&'a self, pred: F) -> bool
where F: FnMut(&'a Pk) -> bool, Pk: 'a,

Run a predicate on every key in the descriptor, returning whether the predicate returned true for any key
Source§

impl<Pk: MiniscriptKey, Arg: ExtParam> From<LegacyCSFSCov<Pk, CovenantExt<Arg>>> for Descriptor<Pk, CovenantExt<Arg>>

Source§

fn from(inner: LegacyCSFSCov<Pk, CovenantExt<Arg>>) -> Self

Converts to this type from the input type.
Source§

impl<Pk, Ext> FromStr for LegacyCSFSCov<Pk, Ext>
where Pk: FromStrKey, Ext: Extension,

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<Pk, Ext> FromTree for LegacyCSFSCov<Pk, Ext>
where Pk: FromStrKey, Ext: Extension,

Source§

fn from_tree(top: &Tree<'_>) -> Result<Self, Error>

Extract a structure from Tree representation
Source§

impl<Pk: Ord + MiniscriptKey, Ext: Ord + Extension> Ord for LegacyCSFSCov<Pk, Ext>

Source§

fn cmp(&self, other: &LegacyCSFSCov<Pk, Ext>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<Pk: PartialEq + MiniscriptKey, Ext: PartialEq + Extension> PartialEq for LegacyCSFSCov<Pk, Ext>

Source§

fn eq(&self, other: &LegacyCSFSCov<Pk, Ext>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Pk: PartialOrd + MiniscriptKey, Ext: PartialOrd + Extension> PartialOrd for LegacyCSFSCov<Pk, Ext>

Source§

fn partial_cmp(&self, other: &LegacyCSFSCov<Pk, Ext>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<Pk, Ext, ExtQ> TranslateExt<Ext, ExtQ> for LegacyCSFSCov<Pk, Ext>
where Pk: MiniscriptKey, Ext: Extension + TranslateExt<Ext, ExtQ, Output = ExtQ>, ExtQ: Extension,

Source§

type Output = LegacyCSFSCov<Pk, ExtQ>

The associated output type.
Source§

fn translate_ext<T, E>(&self, translator: &mut T) -> Result<Self::Output, E>
where T: ExtTranslator<Ext, ExtQ, E>,

Translates a struct from one generic to another where the translations for Pk are provided by the given Translator.
Source§

impl<P, Q, Ext> TranslatePk<P, Q> for LegacyCSFSCov<P, Ext>

Source§

type Output = LegacyCSFSCov<Q, Ext>

The associated output type. This must be Self<Q>.
Source§

fn translate_pk<T, E>(&self, t: &mut T) -> Result<Self::Output, E>
where T: Translator<P, Q, E>,

Translates a struct from one generic to another where the translations for Pk are provided by the given Translator.
Source§

impl<Pk: Eq + MiniscriptKey, Ext: Eq + Extension> Eq for LegacyCSFSCov<Pk, Ext>

Source§

impl<Pk: MiniscriptKey, Ext: Extension> StructuralPartialEq for LegacyCSFSCov<Pk, Ext>

Auto Trait Implementations§

§

impl<Pk, Ext> Freeze for LegacyCSFSCov<Pk, Ext>

§

impl<Pk, Ext> RefUnwindSafe for LegacyCSFSCov<Pk, Ext>

§

impl<Pk, Ext> Send for LegacyCSFSCov<Pk, Ext>
where Pk: Send + Sync, <Pk as MiniscriptKey>::Sha256: Send + Sync, <Pk as MiniscriptKey>::Hash256: Send + Sync, <Pk as MiniscriptKey>::Ripemd160: Send + Sync, <Pk as MiniscriptKey>::Hash160: Send + Sync, Ext: Send + Sync,

§

impl<Pk, Ext> Sync for LegacyCSFSCov<Pk, Ext>
where Pk: Sync + Send, <Pk as MiniscriptKey>::Sha256: Sync + Send, <Pk as MiniscriptKey>::Hash256: Sync + Send, <Pk as MiniscriptKey>::Ripemd160: Sync + Send, <Pk as MiniscriptKey>::Hash160: Sync + Send, Ext: Sync + Send,

§

impl<Pk, Ext> Unpin for LegacyCSFSCov<Pk, Ext>
where Pk: Unpin, <Pk as MiniscriptKey>::Sha256: Unpin, <Pk as MiniscriptKey>::Hash256: Unpin, <Pk as MiniscriptKey>::Ripemd160: Unpin, <Pk as MiniscriptKey>::Hash160: Unpin, Ext: Unpin,

§

impl<Pk, Ext> UnwindSafe for LegacyCSFSCov<Pk, Ext>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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

Source§

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

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

Source§

fn vzip(self) -> V