Merge pull request #611 from sgeisler/2021-06-fix-release

Fix release 0.26.2
This commit is contained in:
Andrew Poelstra 2021-06-08 16:43:33 +00:00 committed by GitHub
commit 9b2098517e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 7 deletions

View File

@ -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) - [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) - [Make uint types (un)serializable](https://github.com/rust-bitcoin/rust-bitcoin/pull/511)

View File

@ -1,6 +1,6 @@
[package] [package]
name = "bitcoin" name = "bitcoin"
version = "0.26.1" version = "0.26.2"
authors = ["Andrew Poelstra <apoelstra@wpsoftware.net>"] authors = ["Andrew Poelstra <apoelstra@wpsoftware.net>"]
license = "CC0-1.0" license = "CC0-1.0"
homepage = "https://github.com/rust-bitcoin/rust-bitcoin/" homepage = "https://github.com/rust-bitcoin/rust-bitcoin/"

View File

@ -172,7 +172,7 @@ impl fmt::Display for ChildNumber {
ChildNumber::Hardened { index } => { ChildNumber::Hardened { index } => {
fmt::Display::fmt(&index, f)?; fmt::Display::fmt(&index, f)?;
let alt = f.alternate(); 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), ChildNumber::Normal { index } => fmt::Display::fmt(&index, f),
} }
@ -1070,10 +1070,10 @@ mod tests {
#[test] #[test]
fn fmt_child_number() { fn fmt_child_number() {
assert_eq!("000005'", &format!("{:#06}", ChildNumber::from_hardened_idx(5).unwrap())); assert_eq!("000005h", &format!("{:#06}", ChildNumber::from_hardened_idx(5).unwrap()));
assert_eq!("5'", &format!("{:#}", 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!("000005'", &format!("{:06}", ChildNumber::from_hardened_idx(5).unwrap()));
assert_eq!("5h", &format!("{}", 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!("42", &format!("{}", ChildNumber::from_normal_idx(42).unwrap()));
assert_eq!("000042", &format!("{:06}", ChildNumber::from_normal_idx(42).unwrap())); assert_eq!("000042", &format!("{:06}", ChildNumber::from_normal_idx(42).unwrap()));
} }