Enum miniscript::Tap
source · pub enum Tap {}
Expand description
Tap ScriptContext
Trait Implementations§
source§impl Ord for Tap
impl Ord for Tap
source§impl PartialOrd<Tap> for Tap
impl PartialOrd<Tap> for Tap
1.0.0 · source§fn 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 moresource§impl ScriptContext for Tap
impl ScriptContext for Tap
§type Key = XOnlyPublicKey
type Key = XOnlyPublicKey
The consensus key associated with the type. Must be a parseable key
source§fn check_terminal_non_malleable<Pk: MiniscriptKey>(
_frag: &Terminal<Pk, Self>
) -> Result<(), ScriptContextError>
fn check_terminal_non_malleable<Pk: MiniscriptKey>( _frag: &Terminal<Pk, Self> ) -> Result<(), ScriptContextError>
Depending on ScriptContext, fragments can be malleable. For Example,
under Legacy context, PkH is malleable because it is possible to
estimate the cost of satisfaction because of compressed keys
This is currently only used in compiler code for removing malleable
compilations.
This does NOT recursively check if the children of the fragment are
valid or not. Since the compilation proceeds in a leaf to root fashion,
a recursive check is unnecessary.
source§fn check_pk<Pk: MiniscriptKey>(pk: &Pk) -> Result<(), ScriptContextError>
fn check_pk<Pk: MiniscriptKey>(pk: &Pk) -> Result<(), ScriptContextError>
Each context has slightly different rules on what Pks are allowed in descriptors
Legacy/Bare does not allow x_only keys
Segwit does not allow uncompressed keys and x_only keys
Tapscript does not allow uncompressed keys
source§fn check_witness<Pk: MiniscriptKey>(
witness: &[Vec<u8>]
) -> Result<(), ScriptContextError>
fn check_witness<Pk: MiniscriptKey>( witness: &[Vec<u8>] ) -> Result<(), ScriptContextError>
Check whether the given satisfaction is valid under the ScriptContext
For example, segwit satisfactions may fail if the witness len is more
3600 or number of stack elements are more than 100.
source§fn check_global_consensus_validity<Pk: MiniscriptKey>(
ms: &Miniscript<Pk, Self>
) -> Result<(), ScriptContextError>
fn check_global_consensus_validity<Pk: MiniscriptKey>( ms: &Miniscript<Pk, Self> ) -> Result<(), ScriptContextError>
Depending on script Context, some of the Terminals might not
be valid under the current consensus rules.
Or some of the script resource limits may have been exceeded.
These miniscripts would never be accepted by the Bitcoin network and hence
it is safe to discard them
For example, in Segwit Context with MiniscriptKey as bitcoin::PublicKey
uncompressed public keys are non-standard and thus invalid.
In LegacyP2SH context, scripts above 520 bytes are invalid.
Post Tapscript upgrade, this would have to consider other nodes.
This does NOT recursively check the miniscript fragments.
source§fn check_local_consensus_validity<Pk: MiniscriptKey>(
ms: &Miniscript<Pk, Self>
) -> Result<(), ScriptContextError>
fn check_local_consensus_validity<Pk: MiniscriptKey>( ms: &Miniscript<Pk, Self> ) -> Result<(), ScriptContextError>
Consensus rules at the Miniscript satisfaction time.
It is possible that some paths of miniscript may exceed resource limits
and our current satisfier and lifting analysis would not work correctly.
For example, satisfaction path(Legacy/Segwitv0) may require more than 201 opcodes.
source§fn check_global_policy_validity<Pk: MiniscriptKey>(
_ms: &Miniscript<Pk, Self>
) -> Result<(), ScriptContextError>
fn check_global_policy_validity<Pk: MiniscriptKey>( _ms: &Miniscript<Pk, Self> ) -> Result<(), ScriptContextError>
Depending on script Context, some of the script resource limits
may have been exceeded under the current bitcoin core policy rules
These miniscripts would never be accepted by the Bitcoin network and hence
it is safe to discard them. (unless explicitly disabled by non-standard flag)
For example, in Segwit Context with MiniscriptKey as bitcoin::PublicKey
scripts over 3600 bytes are invalid.
Post Tapscript upgrade, this would have to consider other nodes.
This does NOT recursively check the miniscript fragments.
source§fn check_local_policy_validity<Pk: MiniscriptKey>(
_ms: &Miniscript<Pk, Self>
) -> Result<(), ScriptContextError>
fn check_local_policy_validity<Pk: MiniscriptKey>( _ms: &Miniscript<Pk, Self> ) -> Result<(), ScriptContextError>
Policy rules at the Miniscript satisfaction time.
It is possible that some paths of miniscript may exceed resource limits
and our current satisfier and lifting analysis would not work correctly.
For example, satisfaction path in Legacy context scriptSig more
than 1650 bytes
source§fn max_satisfaction_size<Pk: MiniscriptKey>(
ms: &Miniscript<Pk, Self>
) -> Option<usize>
fn max_satisfaction_size<Pk: MiniscriptKey>( ms: &Miniscript<Pk, Self> ) -> Option<usize>
Depending on script context, the size of a satifaction witness may slightly differ.
source§fn pk_len<Pk: MiniscriptKey>(_pk: &Pk) -> usize
fn pk_len<Pk: MiniscriptKey>(_pk: &Pk) -> usize
Get the len of public key when serialized based on context
Note that this includes the serialization prefix. Returns
34/66 for Bare/Legacy based on key compressedness
34 for Segwitv0, 33 for Tap
source§fn check_global_validity<Pk: MiniscriptKey>(
ms: &Miniscript<Pk, Self>
) -> Result<(), ScriptContextError>
fn check_global_validity<Pk: MiniscriptKey>( ms: &Miniscript<Pk, Self> ) -> Result<(), ScriptContextError>
Check the consensus + policy(if not disabled) rules that are not based
satisfaction
source§fn check_local_validity<Pk: MiniscriptKey>(
ms: &Miniscript<Pk, Self>
) -> Result<(), ScriptContextError>
fn check_local_validity<Pk: MiniscriptKey>( ms: &Miniscript<Pk, Self> ) -> Result<(), ScriptContextError>
Check the consensus + policy(if not disabled) rules including the
ones for satisfaction
source§fn top_level_type_check<Pk: MiniscriptKey>(
ms: &Miniscript<Pk, Self>
) -> Result<(), Error>
fn top_level_type_check<Pk: MiniscriptKey>( ms: &Miniscript<Pk, Self> ) -> Result<(), Error>
Check whether the top-level is type B
source§fn other_top_level_checks<Pk: MiniscriptKey>(
_ms: &Miniscript<Pk, Self>
) -> Result<(), Error>
fn other_top_level_checks<Pk: MiniscriptKey>( _ms: &Miniscript<Pk, Self> ) -> Result<(), Error>
Other top level checks that are context specific
source§fn top_level_checks<Pk: MiniscriptKey>(
ms: &Miniscript<Pk, Self>
) -> Result<(), Error>
fn top_level_checks<Pk: MiniscriptKey>( ms: &Miniscript<Pk, Self> ) -> Result<(), Error>
Check top level consensus rules.
impl Eq for Tap
impl StructuralEq for Tap
impl StructuralPartialEq for Tap
Auto Trait Implementations§
impl RefUnwindSafe for Tap
impl Send for Tap
impl Sync for Tap
impl Unpin for Tap
impl UnwindSafe for Tap
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more