diff --git a/src/seedsigner/helpers/embit_utils.py b/src/seedsigner/helpers/embit_utils.py index b32d5d0a..da8f827a 100644 --- a/src/seedsigner/helpers/embit_utils.py +++ b/src/seedsigner/helpers/embit_utils.py @@ -142,7 +142,6 @@ def parse_derivation_path(derivation_path: str) -> dict: } details = dict() - details["wallet_derivation_path"] = "/".join(sections[:-2]) details["script_type"] = lookups["script_types"].get(sections[1]) if not details["script_type"]: details["script_type"] = SettingsConstants.CUSTOM_DERIVATION @@ -153,13 +152,19 @@ def parse_derivation_path(derivation_path: str) -> dict: details["is_change"] = sections[-2] == "1" else: details["is_change"] = None - + # Check if there's a standard address index if sections[-1].isdigit(): details["index"] = int(sections[-1]) else: details["index"] = None + if details["is_change"] is not None and details["index"] is not None: + # standard change and addr index; safe to truncate to the wallet level + details["wallet_derivation_path"] = "/".join(sections[:-2]) + else: + details["wallet_derivation_path"] = None + details["clean_match"] = True for k, v in details.items(): if v is None: