Struct sapio_miniscript::descriptor::SortedMultiVec
source · [−]pub struct SortedMultiVec<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
sourceimpl<Pk: MiniscriptKey, Ctx: ScriptContext> SortedMultiVec<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> SortedMultiVec<Pk, Ctx>
sourcepub fn new(k: usize, pks: Vec<Pk>) -> Result<Self, Error>
pub fn new(k: usize, pks: Vec<Pk>) -> Result<Self, 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
.
sourcepub fn from_tree(tree: &Tree<'_>) -> Result<Self, Error> where
Pk: FromStr,
<Pk as FromStr>::Err: ToString,
pub fn from_tree(tree: &Tree<'_>) -> Result<Self, Error> where
Pk: FromStr,
<Pk as FromStr>::Err: ToString,
Parse an expression tree into a SortedMultiVec
sourcepub fn translate_pk<FPk, Q, FuncError>(
&self,
translatefpk: &mut FPk
) -> Result<SortedMultiVec<Q, Ctx>, FuncError> where
FPk: FnMut(&Pk) -> Result<Q, FuncError>,
Q: MiniscriptKey,
pub fn translate_pk<FPk, Q, FuncError>(
&self,
translatefpk: &mut FPk
) -> Result<SortedMultiVec<Q, Ctx>, FuncError> where
FPk: FnMut(&Pk) -> Result<Q, FuncError>,
Q: MiniscriptKey,
This will panic if translatefpk returns an uncompressed key when converting to a Segwit descriptor. To prevent this panic, ensure translatefpk returns an error in this case instead.
sourceimpl<Pk: MiniscriptKey, Ctx: ScriptContext> SortedMultiVec<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> SortedMultiVec<Pk, Ctx>
sourcepub fn sanity_check(&self) -> Result<(), Error>
pub fn sanity_check(&self) -> Result<(), Error>
utility function to sanity a sorted multi vec
sourceimpl<Pk: MiniscriptKey, Ctx: ScriptContext> SortedMultiVec<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> SortedMultiVec<Pk, Ctx>
sourcepub fn sorted_node(&self) -> Terminal<Pk, Ctx> where
Pk: ToPublicKey,
pub fn sorted_node(&self) -> Terminal<Pk, Ctx> where
Pk: ToPublicKey,
Create Terminal::Multi containing sorted pubkeys
sourcepub fn encode(&self) -> Script where
Pk: ToPublicKey,
pub fn encode(&self) -> Script where
Pk: ToPublicKey,
Encode as a Bitcoin script
sourcepub fn satisfy<S>(&self, satisfier: S) -> Result<Vec<Vec<u8>>, Error> where
Pk: ToPublicKey,
S: Satisfier<Pk>,
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
sourcepub fn script_size(&self) -> usize
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.
sourcepub fn max_satisfaction_witness_elements(&self) -> usize
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.)
sourcepub fn max_satisfaction_size(&self) -> usize
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
sourceimpl<Pk: Clone + MiniscriptKey, Ctx: Clone + ScriptContext> Clone for SortedMultiVec<Pk, Ctx>
impl<Pk: Clone + MiniscriptKey, Ctx: Clone + ScriptContext> Clone for SortedMultiVec<Pk, Ctx>
sourcefn clone(&self) -> SortedMultiVec<Pk, Ctx>
fn clone(&self) -> SortedMultiVec<Pk, Ctx>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<Pk: MiniscriptKey, Ctx: ScriptContext> Debug for SortedMultiVec<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> Debug for SortedMultiVec<Pk, Ctx>
sourceimpl<Pk: MiniscriptKey, Ctx: ScriptContext> Display for SortedMultiVec<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> Display for SortedMultiVec<Pk, Ctx>
sourceimpl<Pk: MiniscriptKey, Ctx: ScriptContext> ForEachKey<Pk> for SortedMultiVec<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> ForEachKey<Pk> for SortedMultiVec<Pk, Ctx>
sourceimpl<Pk: Hash + MiniscriptKey, Ctx: Hash + ScriptContext> Hash for SortedMultiVec<Pk, Ctx>
impl<Pk: Hash + MiniscriptKey, Ctx: Hash + ScriptContext> Hash for SortedMultiVec<Pk, Ctx>
sourceimpl<Pk: MiniscriptKey, Ctx: ScriptContext> Liftable<Pk> for SortedMultiVec<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> Liftable<Pk> for SortedMultiVec<Pk, Ctx>
sourceimpl<Pk: Ord + MiniscriptKey, Ctx: Ord + ScriptContext> Ord for SortedMultiVec<Pk, Ctx>
impl<Pk: Ord + MiniscriptKey, Ctx: Ord + ScriptContext> Ord for SortedMultiVec<Pk, Ctx>
sourceimpl<Pk: PartialEq + MiniscriptKey, Ctx: PartialEq + ScriptContext> PartialEq<SortedMultiVec<Pk, Ctx>> for SortedMultiVec<Pk, Ctx>
impl<Pk: PartialEq + MiniscriptKey, Ctx: PartialEq + ScriptContext> PartialEq<SortedMultiVec<Pk, Ctx>> for SortedMultiVec<Pk, Ctx>
sourcefn eq(&self, other: &SortedMultiVec<Pk, Ctx>) -> bool
fn eq(&self, other: &SortedMultiVec<Pk, Ctx>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SortedMultiVec<Pk, Ctx>) -> bool
fn ne(&self, other: &SortedMultiVec<Pk, Ctx>) -> bool
This method tests for !=
.
sourceimpl<Pk: PartialOrd + MiniscriptKey, Ctx: PartialOrd + ScriptContext> PartialOrd<SortedMultiVec<Pk, Ctx>> for SortedMultiVec<Pk, Ctx>
impl<Pk: PartialOrd + MiniscriptKey, Ctx: PartialOrd + ScriptContext> PartialOrd<SortedMultiVec<Pk, Ctx>> for SortedMultiVec<Pk, Ctx>
sourcefn partial_cmp(&self, other: &SortedMultiVec<Pk, Ctx>) -> Option<Ordering>
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 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn le(&self, other: &Rhs) -> bool
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
impl<Pk: Eq + MiniscriptKey, Ctx: Eq + ScriptContext> Eq for SortedMultiVec<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> StructuralEq for SortedMultiVec<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> StructuralPartialEq for SortedMultiVec<Pk, Ctx>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more