Skip to content

Commit

Permalink
add default val for LegacyAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
dimxy committed Oct 9, 2023
1 parent 3d834c5 commit e1e72df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm2src/mm2_bitcoin/keys/src/legacyaddress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{address::detect_checksum, Error};

/// Struct for legacy address representation.
/// Note: LegacyAddress::from_str deserialization is added, which is used at least in the convertaddress rpc.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Default)]
pub struct LegacyAddress {
/// The prefixes of the address.
pub prefixes: AddressPrefixes,
Expand Down Expand Up @@ -88,7 +88,7 @@ impl FromStr for LegacyAddress {
}

impl From<&'static str> for LegacyAddress {
fn from(s: &'static str) -> Self { s.parse().unwrap() } // TODO: dangerous unwrap?
fn from(s: &'static str) -> Self { s.parse().unwrap_or_default() }
}

impl fmt::Display for LegacyAddress {
Expand Down

0 comments on commit e1e72df

Please sign in to comment.