diff --git a/CHANGELOG.md b/CHANGELOG.md index c5bfafc89..e7857a5ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# # 12.3.0 - August 31, 2024 + +- Fix incorrect string serialization of `and_b` [#735](https://github.com/rust-bitcoin/rust-miniscript/pull/735) + # # 12.2.0 - July 20, 2024 - Fix panics while decoding large miniscripts from script [#712](https://github.com/rust-bitcoin/rust-miniscript/pull/712) diff --git a/Cargo-minimal.lock b/Cargo-minimal.lock index 1caed3d9f..c64d34cf0 100644 --- a/Cargo-minimal.lock +++ b/Cargo-minimal.lock @@ -316,7 +316,7 @@ dependencies = [ [[package]] name = "miniscript" -version = "12.2.0" +version = "12.3.0" dependencies = [ "bech32", "bitcoin", diff --git a/Cargo-recent.lock b/Cargo-recent.lock index d408d6cf3..ffc1fbbce 100644 --- a/Cargo-recent.lock +++ b/Cargo-recent.lock @@ -294,7 +294,7 @@ dependencies = [ [[package]] name = "miniscript" -version = "12.2.0" +version = "12.3.0" dependencies = [ "bech32", "bitcoin", diff --git a/Cargo.toml b/Cargo.toml index 65c0f24b7..ac0e2c10a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "miniscript" -version = "12.2.0" +version = "12.3.0" authors = ["Andrew Poelstra , Sanket Kanjalkar "] license = "CC0-1.0" homepage = "https://github.com/rust-bitcoin/rust-miniscript/" diff --git a/src/descriptor/tr.rs b/src/descriptor/tr.rs index 6018551c9..9fc4d445d 100644 --- a/src/descriptor/tr.rs +++ b/src/descriptor/tr.rs @@ -587,9 +587,6 @@ fn parse_tr_tree(s: &str) -> Result { return Err(Error::Unexpected("invalid taproot internal key".to_string())); } let internal_key = expression::Tree { name: key.name, args: vec![] }; - if script.is_empty() { - return Ok(expression::Tree { name: "tr", args: vec![internal_key] }); - } let (tree, rest) = expression::Tree::from_slice_delim(script, 1, '{')?; if rest.is_empty() { Ok(expression::Tree { name: "tr", args: vec![internal_key, tree] }) @@ -770,6 +767,14 @@ mod tests { desc.replace(&[' ', '\n'][..], "") } + #[test] + fn regression_736() { + crate::Descriptor::::from_str( + "tr(0000000000000000000000000000000000000000000000000000000000000002,)", + ) + .unwrap_err(); + } + #[test] fn for_each() { let desc = descriptor(); diff --git a/src/miniscript/astelem.rs b/src/miniscript/astelem.rs index 58c91befb..7b738b9c9 100644 --- a/src/miniscript/astelem.rs +++ b/src/miniscript/astelem.rs @@ -62,7 +62,7 @@ impl Terminal { Terminal::AndB(ref l, ref r) => fmt_2(f, "and_b(", l, r, is_debug), Terminal::AndOr(ref a, ref b, ref c) => { if c.node == Terminal::False { - fmt_2(f, "and_b(", a, b, is_debug) + fmt_2(f, "and_n(", a, b, is_debug) } else { f.write_str("andor(")?; conditional_fmt(f, a, is_debug)?; diff --git a/src/primitives/relative_locktime.rs b/src/primitives/relative_locktime.rs index 05239a498..787158dfe 100644 --- a/src/primitives/relative_locktime.rs +++ b/src/primitives/relative_locktime.rs @@ -65,7 +65,7 @@ impl RelLockTime { impl convert::TryFrom for RelLockTime { type Error = RelLockTimeError; fn try_from(seq: Sequence) -> Result { - if seq.is_relative_lock_time() { + if seq.is_relative_lock_time() && seq != Sequence::ZERO { Ok(RelLockTime(seq)) } else { Err(RelLockTimeError { value: seq.to_consensus_u32() })