Skip to content

Commit

Permalink
Upgrade bitcoin to 0.32
Browse files Browse the repository at this point in the history
InvalidNetworkError no longer reports address.network() since
that method was removed.
  • Loading branch information
DanGould committed Aug 1, 2024
1 parent 23c26cb commit a9d5649
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ non-compliant-bytes = ["either"]
[dependencies]
either = { version = "1.6.1", optional = true }
percent-encoding-rfc3986 = "0.1.3"
bitcoin = { version = "0.31.0", default-features = false }
bitcoin = { version = "0.32.0", default-features = false }

[dev-dependencies]
bitcoin = { version = "0.31.0", features = ["std"] }
bitcoin = { version = "0.32.0", features = ["std"] }
9 changes: 1 addition & 8 deletions src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ enum UriErrorInner {
TooShort,
InvalidScheme,
Address(AddressError),
AddressNetwork(bitcoin::address::Error),
Amount(ParseAmountError),
UnknownRequiredParameter(String),
PercentDecode {
Expand Down Expand Up @@ -256,7 +255,6 @@ impl fmt::Display for UriError {
UriErrorInner::TooShort => write!(f, "the URI is too short"),
UriErrorInner::InvalidScheme => write!(f, "the URI has invalid scheme"),
UriErrorInner::Address(_) => write!(f, "the address is invalid"),
UriErrorInner::AddressNetwork(_) => write!(f, "the address network is invalid"),
UriErrorInner::Amount(_) => write!(f, "the amount is invalid"),
UriErrorInner::UnknownRequiredParameter(parameter) => write!(f, "the URI contains unknown required parameter '{}'", parameter),
#[cfg(feature = "std")]
Expand All @@ -276,7 +274,6 @@ impl std::error::Error for UriError {
UriErrorInner::TooShort => None,
UriErrorInner::InvalidScheme => None,
UriErrorInner::Address(error) => Some(error),
UriErrorInner::AddressNetwork(error) => Some(error),
UriErrorInner::Amount(error) => Some(error),
UriErrorInner::UnknownRequiredParameter(_) => None,
UriErrorInner::PercentDecode { parameter: _, error } => Some(error),
Expand Down Expand Up @@ -328,11 +325,7 @@ impl<'a, T: DeserializeParams<'a>> Uri<'a, bitcoin::address::NetworkUnchecked, T
///
/// For details about this mechanism, see section [*parsing addresses*](bitcoin::Address#parsing-addresses) on [`bitcoin::Address`].
pub fn require_network(self, network: bitcoin::Network) -> Result<Uri<'a, bitcoin::address::NetworkChecked, T>, Error<T::Error>> {
let address = self
.address
.require_network(network)
.map_err(UriErrorInner::AddressNetwork)
.map_err(Error::uri)?;
let address = self.address.require_network(network).map_err(Error::uri)?;
Ok(Uri {
address,
amount: self.amount,
Expand Down

0 comments on commit a9d5649

Please sign in to comment.