From a9d56490922d29fb193b317939710919aca22601 Mon Sep 17 00:00:00 2001 From: DanGould Date: Tue, 30 Jul 2024 14:20:56 -0400 Subject: [PATCH] Upgrade bitcoin to 0.32 InvalidNetworkError no longer reports address.network() since that method was removed. --- Cargo.toml | 4 ++-- src/de.rs | 9 +-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 294397f..063eb12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] } diff --git a/src/de.rs b/src/de.rs index 674893c..fd7e84e 100644 --- a/src/de.rs +++ b/src/de.rs @@ -228,7 +228,6 @@ enum UriErrorInner { TooShort, InvalidScheme, Address(AddressError), - AddressNetwork(bitcoin::address::Error), Amount(ParseAmountError), UnknownRequiredParameter(String), PercentDecode { @@ -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")] @@ -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), @@ -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, 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,