fix address explorer ownership for complex wallets

This commit is contained in:
scgbckbone 2025-10-05 22:37:19 +02:00
parent b870f93eb0
commit f3168475a1
3 changed files with 15 additions and 9 deletions

View File

@ -405,7 +405,7 @@ def generate_address_csv(path, addr_fmt, ms_wallet, account_num, n, start=0, cha
# saver will be None if we don't think it worth saving these addresses
saver = OWNERSHIP.saver(ms_wallet, change, start, n)
for line in ms_wallet.generate_address_csv(start, n, change):
for line in ms_wallet.generate_address_csv(start, n, change, saver=saver):
yield line
if saver:

View File

@ -646,7 +646,7 @@ class MiniScriptWallet(WalletABC):
return msg, addrs
def generate_address_csv(self, start, n, change):
def generate_address_csv(self, start, n, change, saver=None):
scripts = settings.get("aemscsv", False)
header = ['Index', 'Payment Address']
if scripts:
@ -654,6 +654,9 @@ class MiniScriptWallet(WalletABC):
yield '"' + '","'.join(header) + '"\n'
for idx, addr, ders, script in self.yield_addresses(start, n, change, scripts=scripts):
if saver:
saver(addr, idx)
ln = '%d,"%s"' % (idx, addr)
if scripts:
ln += ',"%s"' % script

View File

@ -353,14 +353,17 @@ def test_address_explorer_saver(af, wipe_cache, settings_set, goto_address_explo
assert addr == addr_from_display_format(story.split("\n\n")[0])
assert title == ('Verified Address' if is_q1 else "Verified!")
assert 'Found in wallet' in story
if "ms" not in af:
assert 'Derivation path' in story
if af == "Segwit P2WPKH":
assert " P2WPKH " in story
elif af == "Classic P2PKH":
assert " P2PKH " in story
else:
assert 'Derivation path' in story
if is_q1:
assert af in story
else:
if "ms" in af:
assert af in story
elif af == "P2SH-Segwit":
assert af in story
else:
part = af.split(" ")[1]
assert part in story
def test_ae_saver(wipe_cache, settings_set, goto_address_explorer, cap_story,