Struct bdk_wallet::keys::SortedMultiVec

pub struct SortedMultiVec<Pk, Ctx>
where Pk: MiniscriptKey, Ctx: ScriptContext,
{ /* private fields */ }
Expand description

Contents of a “sortedmulti” descriptor

Implementations§

§

impl<Pk, Ctx> SortedMultiVec<Pk, Ctx>
where Pk: MiniscriptKey, Ctx: ScriptContext,

pub fn new(k: usize, pks: Vec<Pk>) -> Result<SortedMultiVec<Pk, Ctx>, Error>

Create a new instance of SortedMultiVec given a list of keys and the threshold

Internally checks all the applicable size limits and pubkey types limitations according to the current Ctx.

pub fn from_tree(tree: &Tree<'_>) -> Result<SortedMultiVec<Pk, Ctx>, Error>
where Pk: FromStr, <Pk as FromStr>::Err: Display,

Parse an expression tree into a SortedMultiVec

pub fn translate_pk<T, Q, FuncError>( &self, t: &mut T ) -> Result<SortedMultiVec<Q, Ctx>, TranslateErr<FuncError>>
where T: Translator<Pk, Q, FuncError>, Q: MiniscriptKey,

This will panic if fpk returns an uncompressed key when converting to a Segwit descriptor. To prevent this panic, ensure fpk returns an error in this case instead.

pub fn k(&self) -> usize

The threshold value for the multisig.

pub fn n(&self) -> usize

The number of keys in the multisig.

pub fn pks(&self) -> &[Pk]

Accessor for the public keys in the multisig.

The keys in this structure might not be sorted. In general, they cannot be sorted until they are converted to consensus-encoded public keys, which may not be possible (for example for BIP32 paths with unfilled wildcards).

§

impl<Pk, Ctx> SortedMultiVec<Pk, Ctx>
where Pk: MiniscriptKey, Ctx: ScriptContext,

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

utility function to sanity a sorted multi vec

§

impl<Pk, Ctx> SortedMultiVec<Pk, Ctx>
where Pk: MiniscriptKey, Ctx: ScriptContext,

pub fn sorted_node(&self) -> Terminal<Pk, Ctx>
where Pk: ToPublicKey,

Create Terminal::Multi containing sorted pubkeys

pub fn encode(&self) -> ScriptBuf
where Pk: ToPublicKey,

Encode as a Bitcoin script

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

Attempt to produce a satisfying witness for the witness script represented by the parse tree

pub fn build_template<P>(&self, provider: &P) -> Satisfaction<Placeholder<Pk>>
where Pk: ToPublicKey, P: AssetProvider<Pk>,

Attempt to produce a witness template given the assets available

pub fn script_size(&self) -> usize

Size, in bytes of the script-pubkey. If this Miniscript is used outside of segwit (e.g. in a bare or P2SH descriptor), this quantity should be multiplied by 4 to compute the weight.

In general, it is not recommended to use this function directly, but to instead call the corresponding function on a Descriptor, which will handle the segwit/non-segwit technicalities for you.

pub fn max_satisfaction_witness_elements(&self) -> usize

Maximum number of witness elements used to satisfy the Miniscript fragment, including the witness script itself. Used to estimate the weight of the VarInt that specifies this number in a serialized transaction.

This function may panic on malformed Miniscript objects which do not correspond to semantically sane Scripts. (Such scripts should be rejected at parse time. Any exceptions are bugs.)

pub fn max_satisfaction_size(&self) -> usize

Maximum size, in bytes, of a satisfying witness. In general, it is not recommended to use this function directly, but to instead call the corresponding function on a Descriptor, which will handle the segwit/non-segwit technicalities for you.

All signatures are assumed to be 73 bytes in size, including the length prefix (segwit) or push opcode (pre-segwit) and sighash postfix.

Trait Implementations§

§

impl<Pk, Ctx> Clone for SortedMultiVec<Pk, Ctx>
where Pk: Clone + MiniscriptKey, Ctx: Clone + ScriptContext,

§

fn clone(&self) -> SortedMultiVec<Pk, Ctx>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
§

impl<Pk, Ctx> Debug for SortedMultiVec<Pk, Ctx>
where Pk: MiniscriptKey, Ctx: ScriptContext,

§

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

Formats the value using the given formatter. Read more
§

impl<Pk, Ctx> Display for SortedMultiVec<Pk, Ctx>
where Pk: MiniscriptKey, Ctx: ScriptContext,

§

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

Formats the value using the given formatter. Read more
§

impl<Pk, Ctx> ForEachKey<Pk> for SortedMultiVec<Pk, Ctx>
where Pk: MiniscriptKey, Ctx: ScriptContext,

§

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

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

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
§

impl<Pk, Ctx> Hash for SortedMultiVec<Pk, Ctx>
where Pk: Hash + MiniscriptKey, Ctx: Hash + ScriptContext,

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<Pk, Ctx> Liftable<Pk> for SortedMultiVec<Pk, Ctx>
where Pk: MiniscriptKey, Ctx: ScriptContext,

§

fn lift(&self) -> Result<Policy<Pk>, Error>

Converts this object into an abstract policy.
§

impl<Pk, Ctx> Ord for SortedMultiVec<Pk, Ctx>
where Pk: Ord + MiniscriptKey, Ctx: Ord + ScriptContext,

§

fn cmp(&self, other: &SortedMultiVec<Pk, Ctx>) -> 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 + PartialOrd,

Restrict a value to a certain interval. Read more
§

impl<Pk, Ctx> PartialEq for SortedMultiVec<Pk, Ctx>
where Pk: PartialEq + MiniscriptKey, Ctx: PartialEq + ScriptContext,

§

fn eq(&self, other: &SortedMultiVec<Pk, Ctx>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl<Pk, Ctx> PartialOrd for SortedMultiVec<Pk, Ctx>
where Pk: PartialOrd + MiniscriptKey, Ctx: PartialOrd + ScriptContext,

§

fn partial_cmp(&self, other: &SortedMultiVec<Pk, Ctx>) -> 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

This method 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

This method 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

This method 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

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

impl<Pk, Ctx> Eq for SortedMultiVec<Pk, Ctx>
where Pk: Eq + MiniscriptKey, Ctx: Eq + ScriptContext,

§

impl<Pk, Ctx> StructuralPartialEq for SortedMultiVec<Pk, Ctx>
where Pk: MiniscriptKey, Ctx: ScriptContext,

Auto Trait Implementations§

§

impl<Pk, Ctx> Freeze for SortedMultiVec<Pk, Ctx>

§

impl<Pk, Ctx> RefUnwindSafe for SortedMultiVec<Pk, Ctx>
where Ctx: RefUnwindSafe, Pk: RefUnwindSafe,

§

impl<Pk, Ctx> Send for SortedMultiVec<Pk, Ctx>
where Ctx: Send, Pk: Send,

§

impl<Pk, Ctx> Sync for SortedMultiVec<Pk, Ctx>
where Ctx: Sync, Pk: Sync,

§

impl<Pk, Ctx> Unpin for SortedMultiVec<Pk, Ctx>
where Ctx: Unpin, Pk: Unpin,

§

impl<Pk, Ctx> UnwindSafe for SortedMultiVec<Pk, Ctx>
where Ctx: UnwindSafe, Pk: UnwindSafe,

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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,

§

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§

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

§

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