Struct bdk::keys::SortedMultiVec

source ·
pub struct SortedMultiVec<Pk, Ctx>where
    Pk: MiniscriptKey,
    Ctx: ScriptContext,{
    pub k: usize,
    pub pks: Vec<Pk>,
    /* private fields */
}
Expand description

Contents of a “sortedmulti” descriptor

Fields§

§k: usize

signatures required

§pks: Vec<Pk>

public keys inside sorted Multi

Implementations§

source§

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

source

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.

source

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

Parse an expression tree into a SortedMultiVec

source

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.

source§

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

source

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

utility function to sanity a sorted multi vec

source§

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

source

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

Create Terminal::Multi containing sorted pubkeys

source

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

Encode as a Bitcoin script

source

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

source

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.

source

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.)

source

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§

source§

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

source§

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
source§

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

source§

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

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

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

source§

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

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

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

source§

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

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) -> boolwhere 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, Ctx> Hash for SortedMultiVec<Pk, Ctx>where Pk: Hash + MiniscriptKey, Ctx: Hash + ScriptContext,

source§

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
source§

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

source§

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

Convert the object into an abstract policy
source§

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

source§

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) -> Selfwhere Self: Sized,

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

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

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

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd,

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

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

source§

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

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

source§

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
source§

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

source§

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

source§

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

Auto Trait Implementations§

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CallHasher for Twhere T: Hash + ?Sized,

source§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64where H: Hash + ?Sized, B: BuildHasher,

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere 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 Twhere 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 Twhere 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 Twhere 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 Twhere V: MultiLane<T>,

§

fn vzip(self) -> V