Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
CyonAlexRDX committed Jan 23, 2025
1 parent 9a77078 commit ec1c67a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions crates/crypto/hd/src/bip32/key_space/components/hardened.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ impl FromGlobalKeySpace for Hardened {
}
}

pub const HARDENED_SUFFIX_BIP32: &str = "H";
pub const HARDENED_SUFFIX_BIP44: &str = "'";

impl FromBIP32Str for Hardened {
fn from_bip32_string(s: impl AsRef<str>) -> Result<Self> {
let s = s.as_ref();
Expand Down
4 changes: 2 additions & 2 deletions crates/crypto/hd/src/bip32/key_space/components/securified.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ impl SecurifiedU30 {
Self::SHORTHAND_SYNTAX_SUFFIX,
// We allow the unsecurified syntax as well - since that
// is what we get from the canonical BIP32 strings
UnsecurifiedHardened::VERBOSE_SYNTAX_SUFFIX,
UnsecurifiedHardened::SHORTHAND_SYNTAX_SUFFIX,
HARDENED_SUFFIX_BIP32,
HARDENED_SUFFIX_BIP44,
])?;
let unoffsetted = offsetted
.checked_sub(RELATIVELY_LOCAL_OFFSET_SECURIFIED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ impl TryFrom<u32> for UnsecurifiedHardened {
}

impl IsPathComponentStringConvertible for UnsecurifiedHardened {
const VERBOSE_SYNTAX_SUFFIX: &'static str = "H";
const SHORTHAND_SYNTAX_SUFFIX: &'static str = "'";
const VERBOSE_SYNTAX_SUFFIX: &'static str = HARDENED_SUFFIX_BIP32;
const SHORTHAND_SYNTAX_SUFFIX: &'static str = HARDENED_SUFFIX_BIP44;
}

impl HasIndexInLocalKeySpace for UnsecurifiedHardened {
Expand Down
3 changes: 1 addition & 2 deletions crates/crypto/hd/src/derivation/derivation_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ macro_rules! path_union {
impl FromBIP32Str for $union_name {
fn from_bip32_string(s: impl AsRef<str>) -> Result<Self> {
let s = s.as_ref();
// Result::<Self>::Err(CommonError::InvalidBIP32Path { bad_value: s.to_owned() })
Result::<Self>::Err(CommonError::InvalidDisplayNameEmpty)
Result::<Self>::Err(CommonError::InvalidBIP32Path { bad_value: s.to_owned() })
$(
.or_else(|_| $variant_type::from_bip32_string(s).map(Self::[< $variant_name:snake >]))
)+
Expand Down

0 comments on commit ec1c67a

Please sign in to comment.