pub struct SimpleSatisfier {
pub signatures: HashMap<Vec<u8>, Vec<u8>>,
pub after_satisfied: HashSet<u32>,
pub older_satisfied: HashSet<u32>,
pub sha256_preimages: HashMap<Vec<u8>, Vec<u8>>,
pub ripemd160_preimages: HashMap<Vec<u8>, Vec<u8>>,
pub hash256_preimages: HashMap<Vec<u8>, Vec<u8>>,
pub hash160_preimages: HashMap<Vec<u8>, Vec<u8>>,
}Expand description
A simple satisfier that uses pre-populated data.
This is a convenience implementation of Satisfier that stores signatures,
hash preimages, and timelock information in hash maps and sets. Populate the
fields before passing to Miniscript::satisfy().
§Example
use miniscript_core_ffi::SimpleSatisfier;
let mut satisfier = SimpleSatisfier::new();
// Add a signature for key "A"
satisfier.signatures.insert(b"A".to_vec(), vec![0x30, 0x44, /* ... */]);
// Mark absolute timelock 500000 as satisfied
satisfier.after_satisfied.insert(500000);
// Add a SHA256 preimage
let hash = vec![/* 32-byte hash */];
let preimage = vec![/* preimage bytes */];
satisfier.sha256_preimages.insert(hash, preimage);Fields§
§signatures: HashMap<Vec<u8>, Vec<u8>>Map from key bytes to signature bytes
after_satisfied: HashSet<u32>Set of satisfied absolute timelocks
older_satisfied: HashSet<u32>Set of satisfied relative timelocks
sha256_preimages: HashMap<Vec<u8>, Vec<u8>>Map from SHA256 hash to preimage
ripemd160_preimages: HashMap<Vec<u8>, Vec<u8>>Map from RIPEMD160 hash to preimage
hash256_preimages: HashMap<Vec<u8>, Vec<u8>>Map from HASH256 hash to preimage
hash160_preimages: HashMap<Vec<u8>, Vec<u8>>Map from HASH160 hash to preimage
Implementations§
Trait Implementations§
Source§impl Default for SimpleSatisfier
impl Default for SimpleSatisfier
Source§impl Satisfier for SimpleSatisfier
impl Satisfier for SimpleSatisfier
Source§fn sign(&self, key: &[u8]) -> (Availability, Option<Vec<u8>>)
fn sign(&self, key: &[u8]) -> (Availability, Option<Vec<u8>>)
Sign with the given key, returning the signature bytes. Read more
Source§fn check_after(&self, value: u32) -> bool
fn check_after(&self, value: u32) -> bool
Check if the absolute timelock is satisfied. Read more
Source§fn check_older(&self, value: u32) -> bool
fn check_older(&self, value: u32) -> bool
Check if the relative timelock is satisfied. Read more
Source§fn sat_sha256(&self, hash: &[u8]) -> (Availability, Option<Vec<u8>>)
fn sat_sha256(&self, hash: &[u8]) -> (Availability, Option<Vec<u8>>)
Get the preimage for a SHA256 hash. Read more
Source§fn sat_ripemd160(&self, hash: &[u8]) -> (Availability, Option<Vec<u8>>)
fn sat_ripemd160(&self, hash: &[u8]) -> (Availability, Option<Vec<u8>>)
Get the preimage for a RIPEMD160 hash. Read more
Source§fn sat_hash256(&self, hash: &[u8]) -> (Availability, Option<Vec<u8>>)
fn sat_hash256(&self, hash: &[u8]) -> (Availability, Option<Vec<u8>>)
Get the preimage for a HASH256 (double SHA256) hash. Read more
Source§fn sat_hash160(&self, hash: &[u8]) -> (Availability, Option<Vec<u8>>)
fn sat_hash160(&self, hash: &[u8]) -> (Availability, Option<Vec<u8>>)
Get the preimage for a HASH160 hash. Read more
Auto Trait Implementations§
impl Freeze for SimpleSatisfier
impl RefUnwindSafe for SimpleSatisfier
impl Send for SimpleSatisfier
impl Sync for SimpleSatisfier
impl Unpin for SimpleSatisfier
impl UnwindSafe for SimpleSatisfier
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