Trait simplicity::policy::Satisfier
source · pub trait Satisfier<Pk: ToXOnlyPubkey> {
// Provided methods
fn lookup_tap_leaf_script_sig(
&self,
_: &Pk,
_: &TapLeafHash
) -> Option<SchnorrSig> { ... }
fn lookup_sha256(&self, _: &Pk::Sha256) -> Option<Preimage32> { ... }
fn check_older(&self, _: Sequence) -> bool { ... }
fn check_after(&self, _: LockTime) -> bool { ... }
fn lookup_asm_program(&self, _: Cmr) -> Option<Arc<WitnessNode<Elements>>> { ... }
}Expand description
Lookup table for signatures, hash preimages, etc.
Every method has a default implementation that simply returns None
on every query. Users are expected to override the methods that they
have data for.
Provided Methods§
sourcefn lookup_tap_leaf_script_sig(
&self,
_: &Pk,
_: &TapLeafHash
) -> Option<SchnorrSig>
fn lookup_tap_leaf_script_sig( &self, _: &Pk, _: &TapLeafHash ) -> Option<SchnorrSig>
Given a public key, look up a Schnorr signature with that key.
sourcefn lookup_sha256(&self, _: &Pk::Sha256) -> Option<Preimage32>
fn lookup_sha256(&self, _: &Pk::Sha256) -> Option<Preimage32>
Given a SHA256 hash, look up its preimage.
sourcefn check_older(&self, _: Sequence) -> bool
fn check_older(&self, _: Sequence) -> bool
Assert that a relative locktime is satisfied.
sourcefn check_after(&self, _: LockTime) -> bool
fn check_after(&self, _: LockTime) -> bool
Assert that an absolute locktime is satisfied.
sourcefn lookup_asm_program(&self, _: Cmr) -> Option<Arc<WitnessNode<Elements>>>
fn lookup_asm_program(&self, _: Cmr) -> Option<Arc<WitnessNode<Elements>>>
Given a CMR, look up a matching satisfied Simplicity program.
It is the responsibility of the satisfier to make sure that given program is satisfied. That is, each witness note is populated with a value of the correct type and the program successfully runs on the Bit Machine.
If the satisfier provides an unsatisfied program, then this may corrupt the computation of an overall satisfaction. That is, the resulting “satisfaction” fails to satisfy the program.