diff --git a/crates/crypto/hd/src/bip32/key_space/components/hardened.rs b/crates/crypto/hd/src/bip32/key_space/components/hardened.rs index 1abcd2934..f9ed2df51 100644 --- a/crates/crypto/hd/src/bip32/key_space/components/hardened.rs +++ b/crates/crypto/hd/src/bip32/key_space/components/hardened.rs @@ -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) -> Result { let s = s.as_ref(); diff --git a/crates/crypto/hd/src/bip32/key_space/components/securified.rs b/crates/crypto/hd/src/bip32/key_space/components/securified.rs index 2b44f6264..b0358a6ec 100644 --- a/crates/crypto/hd/src/bip32/key_space/components/securified.rs +++ b/crates/crypto/hd/src/bip32/key_space/components/securified.rs @@ -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) diff --git a/crates/crypto/hd/src/bip32/key_space/components/unsecurified_hardened.rs b/crates/crypto/hd/src/bip32/key_space/components/unsecurified_hardened.rs index 0745b8361..87121c1a4 100644 --- a/crates/crypto/hd/src/bip32/key_space/components/unsecurified_hardened.rs +++ b/crates/crypto/hd/src/bip32/key_space/components/unsecurified_hardened.rs @@ -104,8 +104,8 @@ impl TryFrom 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 { diff --git a/crates/crypto/hd/src/derivation/derivation_path.rs b/crates/crypto/hd/src/derivation/derivation_path.rs index 63be3c080..3b854b5b9 100644 --- a/crates/crypto/hd/src/derivation/derivation_path.rs +++ b/crates/crypto/hd/src/derivation/derivation_path.rs @@ -81,8 +81,7 @@ macro_rules! path_union { impl FromBIP32Str for $union_name { fn from_bip32_string(s: impl AsRef) -> Result { let s = s.as_ref(); - // Result::::Err(CommonError::InvalidBIP32Path { bad_value: s.to_owned() }) - Result::::Err(CommonError::InvalidDisplayNameEmpty) + Result::::Err(CommonError::InvalidBIP32Path { bad_value: s.to_owned() }) $( .or_else(|_| $variant_type::from_bip32_string(s).map(Self::[< $variant_name:snake >])) )+