mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-10-05 23:18:25 +00:00
additional safety around "wallet_derivation_path"
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user