Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport] Several small fixes for 12.x #735

Open
wants to merge 4 commits into
base: release-12.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Cargo-minimal.lock
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ dependencies = [

[[package]]
name = "miniscript"
version = "12.2.0"
version = "12.3.0"
dependencies = [
"bech32",
"bitcoin",
Expand Down
2 changes: 1 addition & 1 deletion Cargo-recent.lock
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ dependencies = [

[[package]]
name = "miniscript"
version = "12.2.0"
version = "12.3.0"
dependencies = [
"bech32",
"bitcoin",
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "miniscript"
version = "12.2.0"
version = "12.3.0"
authors = ["Andrew Poelstra <[email protected]>, Sanket Kanjalkar <[email protected]>"]
license = "CC0-1.0"
homepage = "https://github.com/rust-bitcoin/rust-miniscript/"
Expand Down
11 changes: 8 additions & 3 deletions src/descriptor/tr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,6 @@ fn parse_tr_tree(s: &str) -> Result<expression::Tree, Error> {
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] })
Expand Down Expand Up @@ -770,6 +767,14 @@ mod tests {
desc.replace(&[' ', '\n'][..], "")
}

#[test]
fn regression_736() {
crate::Descriptor::<crate::DescriptorPublicKey>::from_str(
"tr(0000000000000000000000000000000000000000000000000000000000000002,)",
)
.unwrap_err();
}

#[test]
fn for_each() {
let desc = descriptor();
Expand Down
2 changes: 1 addition & 1 deletion src/miniscript/astelem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Terminal<Pk, Ctx> {
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)?;
Expand Down
2 changes: 1 addition & 1 deletion src/primitives/relative_locktime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl RelLockTime {
impl convert::TryFrom<Sequence> for RelLockTime {
type Error = RelLockTimeError;
fn try_from(seq: Sequence) -> Result<Self, RelLockTimeError> {
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() })
Expand Down
Loading