From c198b35f92de0800a5fee34a8dc60270cb4c9ee6 Mon Sep 17 00:00:00 2001 From: LORDBABUINO Date: Fri, 27 Feb 2026 01:02:40 -0300 Subject: [PATCH] feat: auto-expand descriptor to both /0/* and /1/* variants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a descriptor is passed directly, strip its checksum, derive the missing external/internal counterpart, and normalize both through getdescriptorinfo before importing — matching the full address set that --wallet produces. --- backend/script/detect.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/backend/script/detect.py b/backend/script/detect.py index 36314fb..a09a5a6 100644 --- a/backend/script/detect.py +++ b/backend/script/detect.py @@ -77,13 +77,25 @@ def resolve_descriptors(args): "range_end": d.get("range", [0, 999])[1] if isinstance(d.get("range"), list) else d.get("range", 999), }) else: - for d in args.descriptors: - descs.append({ - "desc": d, - "internal": "/1/*" in d, - "active": True, - "range_end": 999, - }) + for raw in args.descriptors: + base = raw.split("#")[0] + if "/0/*" in base: + candidates = [(base, False), (base.replace("/0/*", "/1/*"), True)] + elif "/1/*" in base: + candidates = [(base.replace("/1/*", "/0/*"), False), (base, True)] + else: + candidates = [(base, False)] + for desc, internal in candidates: + try: + normalized = cli("getdescriptorinfo", desc)["descriptor"] + except Exception: + normalized = desc + descs.append({ + "desc": normalized, + "internal": internal, + "active": True, + "range_end": 999, + }) return descs