[][src]Trait bdk::descriptor::ScriptContext

pub trait ScriptContext: Sealed + Clone + PartialEq<Self> + Eq + Ord + PartialOrd<Self> + Debug {
    pub fn check_terminal_non_malleable<Pk, Ctx>(
        _frag: &Terminal<Pk, Ctx>
    ) -> Result<(), ScriptContextError>
    where
        Pk: MiniscriptKey,
        Ctx: ScriptContext
;
pub fn max_satisfaction_size<Pk, Ctx>(
        ms: &Miniscript<Pk, Ctx>
    ) -> Option<usize>
    where
        Pk: MiniscriptKey,
        Ctx: ScriptContext
; pub fn check_witness<Pk, Ctx>(
        _witness: &[Vec<u8, Global>]
    ) -> Result<(), ScriptContextError>
    where
        Pk: MiniscriptKey,
        Ctx: ScriptContext
, { ... }
pub fn check_global_consensus_validity<Pk, Ctx>(
        _ms: &Miniscript<Pk, Ctx>
    ) -> Result<(), ScriptContextError>
    where
        Pk: MiniscriptKey,
        Ctx: ScriptContext
, { ... }
pub fn check_global_policy_validity<Pk, Ctx>(
        _ms: &Miniscript<Pk, Ctx>
    ) -> Result<(), ScriptContextError>
    where
        Pk: MiniscriptKey,
        Ctx: ScriptContext
, { ... }
pub fn check_local_consensus_validity<Pk, Ctx>(
        _ms: &Miniscript<Pk, Ctx>
    ) -> Result<(), ScriptContextError>
    where
        Pk: MiniscriptKey,
        Ctx: ScriptContext
, { ... }
pub fn check_local_policy_validity<Pk, Ctx>(
        _ms: &Miniscript<Pk, Ctx>
    ) -> Result<(), ScriptContextError>
    where
        Pk: MiniscriptKey,
        Ctx: ScriptContext
, { ... }
pub fn check_global_validity<Pk, Ctx>(
        ms: &Miniscript<Pk, Ctx>
    ) -> Result<(), ScriptContextError>
    where
        Pk: MiniscriptKey,
        Ctx: ScriptContext
, { ... }
pub fn check_local_validity<Pk, Ctx>(
        ms: &Miniscript<Pk, Ctx>
    ) -> Result<(), ScriptContextError>
    where
        Pk: MiniscriptKey,
        Ctx: ScriptContext
, { ... }
pub fn top_level_type_check<Pk, Ctx>(
        ms: &Miniscript<Pk, Ctx>
    ) -> Result<(), Error>
    where
        Pk: MiniscriptKey,
        Ctx: ScriptContext
, { ... }
pub fn other_top_level_checks<Pk, Ctx>(
        _ms: &Miniscript<Pk, Ctx>
    ) -> Result<(), Error>
    where
        Pk: MiniscriptKey,
        Ctx: ScriptContext
, { ... }
pub fn top_level_checks<Pk, Ctx>(
        ms: &Miniscript<Pk, Ctx>
    ) -> Result<(), Error>
    where
        Pk: MiniscriptKey,
        Ctx: ScriptContext
, { ... } }

The ScriptContext for Miniscript. Additional type information associated with miniscript that is used for carrying out checks that dependent on the context under which the script is used. For example, disallowing uncompressed keys in Segwit context

Required methods

pub fn check_terminal_non_malleable<Pk, Ctx>(
    _frag: &Terminal<Pk, Ctx>
) -> Result<(), ScriptContextError> where
    Pk: MiniscriptKey,
    Ctx: ScriptContext
[src]

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.

pub fn max_satisfaction_size<Pk, Ctx>(ms: &Miniscript<Pk, Ctx>) -> Option<usize> where
    Pk: MiniscriptKey,
    Ctx: ScriptContext
[src]

Depending on script context, the size of a satifaction witness may slightly differ.

Loading content...

Provided methods

pub fn check_witness<Pk, Ctx>(
    _witness: &[Vec<u8, Global>]
) -> Result<(), ScriptContextError> where
    Pk: MiniscriptKey,
    Ctx: ScriptContext
[src]

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.

pub fn check_global_consensus_validity<Pk, Ctx>(
    _ms: &Miniscript<Pk, Ctx>
) -> Result<(), ScriptContextError> where
    Pk: MiniscriptKey,
    Ctx: ScriptContext
[src]

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.

pub fn check_global_policy_validity<Pk, Ctx>(
    _ms: &Miniscript<Pk, Ctx>
) -> Result<(), ScriptContextError> where
    Pk: MiniscriptKey,
    Ctx: ScriptContext
[src]

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.

pub fn check_local_consensus_validity<Pk, Ctx>(
    _ms: &Miniscript<Pk, Ctx>
) -> Result<(), ScriptContextError> where
    Pk: MiniscriptKey,
    Ctx: ScriptContext
[src]

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.

pub fn check_local_policy_validity<Pk, Ctx>(
    _ms: &Miniscript<Pk, Ctx>
) -> Result<(), ScriptContextError> where
    Pk: MiniscriptKey,
    Ctx: ScriptContext
[src]

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

pub fn check_global_validity<Pk, Ctx>(
    ms: &Miniscript<Pk, Ctx>
) -> Result<(), ScriptContextError> where
    Pk: MiniscriptKey,
    Ctx: ScriptContext
[src]

Check the consensus + policy(if not disabled) rules that are not based satisfaction

pub fn check_local_validity<Pk, Ctx>(
    ms: &Miniscript<Pk, Ctx>
) -> Result<(), ScriptContextError> where
    Pk: MiniscriptKey,
    Ctx: ScriptContext
[src]

Check the consensus + policy(if not disabled) rules including the ones for satisfaction

pub fn top_level_type_check<Pk, Ctx>(
    ms: &Miniscript<Pk, Ctx>
) -> Result<(), Error> where
    Pk: MiniscriptKey,
    Ctx: ScriptContext
[src]

Check whether the top-level is type B

pub fn other_top_level_checks<Pk, Ctx>(
    _ms: &Miniscript<Pk, Ctx>
) -> Result<(), Error> where
    Pk: MiniscriptKey,
    Ctx: ScriptContext
[src]

Other top level checks that are context specific

pub fn top_level_checks<Pk, Ctx>(ms: &Miniscript<Pk, Ctx>) -> Result<(), Error> where
    Pk: MiniscriptKey,
    Ctx: ScriptContext
[src]

Check top level consensus rules.

Loading content...

Implementations on Foreign Types

impl ScriptContext for Bare[src]

Loading content...

Implementors

impl ScriptContext for Legacy[src]

impl ScriptContext for Segwitv0[src]

Loading content...