Skip to content

Commit 41d3e41

Browse files
committed
New miniscript compiler
1 parent 9f68b46 commit 41d3e41

File tree

5 files changed

+690
-447
lines changed

5 files changed

+690
-447
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "miniscript"
3-
version = "0.6.0"
3+
version = "0.7.0"
44
authors = ["Andrew Poelstra <[email protected]>"]
55
repository = "https://github.com/apoelstra/miniscript"
66
description = "Miniscript: a subset of Bitcoin Script designed for analysis"

src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,9 @@ pub enum Error {
307307
BadDescriptor,
308308
///Forward-secp related errors
309309
Secp(secp256k1::Error),
310+
#[cfg(feature = "compiler")]
311+
///Compiler related errors
312+
CompilerError(policy::compiler::CompilerError),
310313
///Interpreter related errors
311314
InterpreterError(descriptor::InterpreterError),
312315
/// Bad Script Sig. As per standardness rules, only pushes are allowed in
@@ -395,6 +398,8 @@ impl fmt::Display for Error {
395398
Error::BadDescriptor => f.write_str("could not create a descriptor"),
396399
Error::Secp(ref e) => fmt::Display::fmt(e, f),
397400
Error::InterpreterError(ref e) => fmt::Display::fmt(e, f),
401+
#[cfg(feature = "compiler")]
402+
Error::CompilerError(ref e) => fmt::Display::fmt(e, f),
398403
Error::BadScriptSig => f.write_str("Script sig must only consist of pushes"),
399404
Error::NonEmptyWitness => f.write_str("Non empty witness for Pk/Pkh"),
400405
Error::NonEmptyScriptSig => f.write_str("Non empty script sig for segwit spend"),
@@ -415,6 +420,14 @@ impl From<psbt::Error> for Error {
415420
}
416421
}
417422

423+
#[doc(hidden)]
424+
#[cfg(feature = "compiler")]
425+
impl From<policy::compiler::CompilerError> for Error {
426+
fn from(e: policy::compiler::CompilerError) -> Error {
427+
Error::CompilerError(e)
428+
}
429+
}
430+
418431
/// The size of an encoding of a number in Script
419432
pub fn script_num_size(n: usize) -> usize {
420433
match n {

src/miniscript/satisfy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ impl<Pk: MiniscriptKey + ToPublicKey> Satisfiable<Pk> for Terminal<Pk> {
489489
}
490490
}
491491

492-
impl<Pk: MiniscriptKey> Dissatisfiable<Pk> for Terminal<Pk> {
492+
impl<Pk: MiniscriptKey + ToPublicKey> Dissatisfiable<Pk> for Terminal<Pk> {
493493
fn dissatisfy<S: Satisfier<Pk>>(&self, satisfier: &S) -> Option<Vec<Vec<u8>>> {
494494
match *self {
495495
Terminal::Pk(..) => Some(vec![vec![]]),

0 commit comments

Comments
 (0)