diff --git a/CHANGELOG.md b/CHANGELOG.md index 6460b531..036a035b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ -# 0.26.1 - 2020-06-06 +# 0.26.2 - 2021-06-08 + +- [Fix `Display` impl of `ChildNumber`](https://github.com/rust-bitcoin/rust-bitcoin/pull/611) + +The previous release changed the behavior of `Display` for `ChildNumber`, assuming that any correct usage would not be +affected. [Issue 608](https://github.com/rust-bitcoin/rust-bitcoin/issues/608) goes into the details of why this isn't +the case and how we broke both `rust-miniscript` and BDK. + +# 0.26.1 - 2021-06-06 (yanked, see explanation above) - [Change Amount Debug impl to BTC with 8 decimals](https://github.com/rust-bitcoin/rust-bitcoin/pull/414) - [Make uint types (un)serializable](https://github.com/rust-bitcoin/rust-bitcoin/pull/511) diff --git a/Cargo.toml b/Cargo.toml index 533560e7..0f1ee955 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bitcoin" -version = "0.26.1" +version = "0.26.2" authors = ["Andrew Poelstra "] license = "CC0-1.0" homepage = "https://github.com/rust-bitcoin/rust-bitcoin/" diff --git a/src/util/bip32.rs b/src/util/bip32.rs index c45ec1a6..8f7b91c0 100644 --- a/src/util/bip32.rs +++ b/src/util/bip32.rs @@ -172,7 +172,7 @@ impl fmt::Display for ChildNumber { ChildNumber::Hardened { index } => { fmt::Display::fmt(&index, f)?; let alt = f.alternate(); - f.write_str(if alt { "'" } else { "h" }) + f.write_str(if alt { "h" } else { "'" }) }, ChildNumber::Normal { index } => fmt::Display::fmt(&index, f), } @@ -1070,10 +1070,10 @@ mod tests { #[test] fn fmt_child_number() { - assert_eq!("000005'", &format!("{:#06}", ChildNumber::from_hardened_idx(5).unwrap())); - assert_eq!("5'", &format!("{:#}", ChildNumber::from_hardened_idx(5).unwrap())); - assert_eq!("000005h", &format!("{:06}", ChildNumber::from_hardened_idx(5).unwrap())); - assert_eq!("5h", &format!("{}", ChildNumber::from_hardened_idx(5).unwrap())); + assert_eq!("000005h", &format!("{:#06}", ChildNumber::from_hardened_idx(5).unwrap())); + assert_eq!("5h", &format!("{:#}", ChildNumber::from_hardened_idx(5).unwrap())); + assert_eq!("000005'", &format!("{:06}", ChildNumber::from_hardened_idx(5).unwrap())); + assert_eq!("5'", &format!("{}", ChildNumber::from_hardened_idx(5).unwrap())); assert_eq!("42", &format!("{}", ChildNumber::from_normal_idx(42).unwrap())); assert_eq!("000042", &format!("{:06}", ChildNumber::from_normal_idx(42).unwrap())); }