Skip to content

Commit

Permalink
Merge rust-bitcoin#3664: Release tracking PR: bitcoin 0.32.5
Browse files Browse the repository at this point in the history
b334224 bitcoin: Bump version to 0.32.5 (Tobin C. Harding)
ca3ebd7 bitcoin: Stop using impl_parse_str_from_int (Tobin C. Harding)
170b997 Remove nonsense feature gating (Tobin C. Harding)

Pull request description:

  In preparation for release add a changelog entry, bump the version, and update the lock files - BOOM!

ACKs for top commit:
  apoelstra:
    ACK b334224; tested last two commits; the first fails in the expected way (bad `alloc` cfg flag) and not in any unexpected ways.
  sanket1729:
    utACK b334224

Tree-SHA512: 76fa40ff9d0656af3f1bed37eaf33a9ace8205304ef94bddce1fcaeef8adacf68444a671121df40bb453e77da5dd978bc2c929285787deb55aa2501fbcbd5e2b
  • Loading branch information
apoelstra committed Nov 29, 2024
2 parents 1f84707 + b334224 commit 17ce61c
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo-minimal.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dependencies = [

[[package]]
name = "bitcoin"
version = "0.32.4"
version = "0.32.5"
dependencies = [
"base58ck",
"base64",
Expand Down
2 changes: 1 addition & 1 deletion Cargo-recent.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies = [

[[package]]
name = "bitcoin"
version = "0.32.4"
version = "0.32.5"
dependencies = [
"base58ck",
"base64",
Expand Down
7 changes: 7 additions & 0 deletions bitcoin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 0.32.5 - 2024-11-27

- Backport - Re-export `bech32` crate [#3662](https://github.com/rust-bitcoin/rust-bitcoin/pull/3662)
- Backport - Add API for extracting the inner payload of `RawNetworkMessage` [#3523](https://github.com/rust-bitcoin/rust-bitcoin/pull/3523)
- Backport - Fix bug in witness stack getters [#3626](https://github.com/rust-bitcoin/rust-bitcoin/pull/3626)
- Backport - address: Add `Address::into_unchecked` [#3655](https://github.com/rust-bitcoin/rust-bitcoin/pull/3655)

# 0.32.4 - 2024-10-24

- Bound decode methods on `Read`, rather than `BufRead` [#3173](https://github.com/rust-bitcoin/rust-bitcoin/pull/3173)
Expand Down
2 changes: 1 addition & 1 deletion bitcoin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bitcoin"
version = "0.32.4"
version = "0.32.5"
authors = ["Andrew Poelstra <[email protected]>"]
license = "CC0-1.0"
repository = "https://github.com/rust-bitcoin/rust-bitcoin/"
Expand Down
36 changes: 34 additions & 2 deletions bitcoin/src/blockdata/locktime/absolute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@
use core::cmp::Ordering;
use core::fmt;
use core::str::FromStr;

use io::{Read, Write};
#[cfg(all(test, mutate))]
use mutagen::mutate;
use units::parse;
use units::parse::{self, ParseIntError};

#[cfg(doc)]
use crate::absolute;
use crate::consensus::encode::{self, Decodable, Encodable};
use crate::error::{ContainsPrefixError, MissingPrefixError, PrefixedHexError, UnprefixedHexError};
use crate::prelude::{Box, String};

#[rustfmt::skip] // Keep public re-exports separate.
#[doc(inline)]
Expand Down Expand Up @@ -284,7 +286,37 @@ impl LockTime {
}
}

units::impl_parse_str_from_int_infallible!(LockTime, u32, from_consensus);
impl FromStr for LockTime {
type Err = ParseIntError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
parse::int::<u32, &str>(s).map(LockTime::from_consensus)
}
}

impl TryFrom<&str> for LockTime {
type Error = ParseIntError;

fn try_from(s: &str) -> Result<Self, Self::Error> {
LockTime::from_str(s)
}
}

impl TryFrom<String> for LockTime {
type Error = ParseIntError;

fn try_from(s: String) -> Result<Self, Self::Error> {
LockTime::from_str(&s)
}
}

impl TryFrom<Box<str>> for LockTime {
type Error = ParseIntError;

fn try_from(s: Box<str>) -> Result<Self, Self::Error> {
LockTime::from_str(&s)
}
}

impl From<Height> for LockTime {
#[inline]
Expand Down
37 changes: 34 additions & 3 deletions bitcoin/src/blockdata/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
//! This module provides the structures and functions needed to support transactions.
//!
use core::{cmp, fmt, str};
use core::{cmp, fmt};
use core::str::FromStr;

use hashes::{sha256d, Hash};
use internals::write_err;
use io::{Read, Write};
use units::parse;
use units::parse::{self, ParseIntError};

use super::Weight;
use crate::blockdata::locktime::absolute::{self, Height, Time};
Expand Down Expand Up @@ -527,7 +528,37 @@ impl fmt::Debug for Sequence {
}
}

units::impl_parse_str_from_int_infallible!(Sequence, u32, from_consensus);
impl FromStr for Sequence {
type Err = ParseIntError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
parse::int::<u32, &str>(s).map(Sequence::from_consensus)
}
}

impl TryFrom<&str> for Sequence {
type Error = ParseIntError;

fn try_from(s: &str) -> Result<Self, Self::Error> {
Sequence::from_str(s)
}
}

impl TryFrom<String> for Sequence {
type Error = ParseIntError;

fn try_from(s: String) -> Result<Self, Self::Error> {
Sequence::from_str(&s)
}
}

impl TryFrom<Box<str>> for Sequence {
type Error = ParseIntError;

fn try_from(s: Box<str>) -> Result<Self, Self::Error> {
Sequence::from_str(&s)
}
}

/// Bitcoin transaction output.
///
Expand Down
8 changes: 3 additions & 5 deletions units/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,9 @@ macro_rules! impl_tryfrom_str_from_int_infallible {
#[macro_export]
macro_rules! impl_parse_str_from_int_infallible {
($to:ident, $inner:ident, $fn:ident) => {
#[cfg(all(feature = "alloc", not(feature = "std")))]
$crate::impl_tryfrom_str_from_int_infallible!(&str, $to, $inner, $fn; alloc::string::String, $to, $inner, $fn; alloc::boxed::Box<str>, $to, $inner, $fn);
#[cfg(feature = "std")]
$crate::impl_tryfrom_str_from_int_infallible!(&str, $to, $inner, $fn; std::string::String, $to, $inner, $fn; std::boxed::Box<str>, $to, $inner, $fn);
$crate::impl_tryfrom_str_from_int_infallible!(&str, $to, $inner, $fn);
#[cfg(feature = "alloc")]
$crate::impl_tryfrom_str_from_int_infallible!(alloc::string::String, $to, $inner, $fn; alloc::boxed::Box<str>, $to, $inner, $fn);

impl core::str::FromStr for $to {
type Err = $crate::parse::ParseIntError;
Expand All @@ -161,7 +160,6 @@ macro_rules! impl_parse_str_from_int_infallible {
$crate::parse::int::<$inner, &str>(s).map($to::$fn)
}
}

}
}

Expand Down

0 comments on commit 17ce61c

Please sign in to comment.