Skip to content

Commit

Permalink
refactor: Policy satisfier
Browse files Browse the repository at this point in the history
Remove manual pruning from the policy satisfier. The satisfier still
needs to track the satisfiability of sub-policies, so we introduce a
symmetric Result<T, T> where T is the compiled sub-policy and Ok / Err
signify satisfiability. Refactor the code that satisfies threshold
fragments by using the iterator API and by removing mutable state.

Introduce SatisfierError to better track which errors a satisfier can
actually throw and what to do about them. We can remove the "missing
assembly" error if we allow the construction of hidden nodes.

The satisfier only returns pruned programs and needs to know the
transaction environment because of that. Returning unpruned program
seems like a potential footgun, especially because callers will want to
immediately put their programs on the blockchain.
  • Loading branch information
uncomputable committed Jan 9, 2025
1 parent 78875c4 commit 5a595a0
Show file tree
Hide file tree
Showing 2 changed files with 192 additions and 125 deletions.
2 changes: 1 addition & 1 deletion src/policy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ pub mod sighash;
pub use ast::Policy;
pub use error::Error;
pub use key::{SimplicityKey, ToXOnlyPubkey, Translator};
pub use satisfy::{Preimage32, Satisfier};
pub use satisfy::{Preimage32, Satisfier, SatisfierError};
Loading

0 comments on commit 5a595a0

Please sign in to comment.