Skip to content

Commit

Permalink
Merge #13: Do not manually map numeric error
Browse files Browse the repository at this point in the history
93af3a8 Do not manually map numeric error (Tobin C. Harding)

Pull request description:

  We provide `From` impls for all errors that include a `NumericError` - use it.

ACKs for top commit:
  apoelstra:
    ACK 93af3a8; successfully ran local tests

Tree-SHA512: 235829c69a2f4390f42171062d3f7bf1d49f9b293bc83aff95523060fb1329c6bc8309b67792ea9039d6146c02f73133c396f8e589d4c72f99aa65a07e798544
  • Loading branch information
apoelstra committed Nov 28, 2024
2 parents 6dcf3f2 + 93af3a8 commit b32b8ee
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions types/src/v17/wallet/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,8 @@ impl GetAddressInfo {
.map_err(E::Pubkeys)
})
.transpose()?;
let sigs_required = self
.sigs_required
.map(|s| crate::to_u32(s, "sigs_required"))
.transpose()
.map_err(E::Numeric)?;
let sigs_required =
self.sigs_required.map(|s| crate::to_u32(s, "sigs_required")).transpose()?;
let pubkey = self.pubkey.map(|s| s.parse::<PublicKey>()).transpose().map_err(E::Pubkey)?;
let embedded =
self.embedded.map(|embedded| embedded.into_model()).transpose().map_err(E::Embedded)?;
Expand Down Expand Up @@ -254,11 +251,8 @@ impl GetAddressInfoEmbedded {
.map(|s| s.parse::<PublicKey>())
.collect::<Result<Vec<_>, _>>()
.map_err(E::Pubkeys)?;
let sigs_required = self
.sigs_required
.map(|s| crate::to_u32(s, "sigs_required"))
.transpose()
.map_err(E::Numeric)?;
let sigs_required =
self.sigs_required.map(|s| crate::to_u32(s, "sigs_required")).transpose()?;
let pubkey = self.pubkey.map(|s| s.parse::<PublicKey>()).transpose().map_err(E::Pubkey)?;
let labels = self.labels.into_iter().map(|label| label.into_model()).collect();

Expand Down

0 comments on commit b32b8ee

Please sign in to comment.