1
0

tests: wizard: imported addrs: validate each addr with "is_address()"

This was already done *in the GUIs*, but the backend should definitely
do at least sanity-check-level validation like this.
This commit is contained in:
SomberNight
2025-08-12 18:42:35 +00:00
parent 19b2567da8
commit acc52e392c
2 changed files with 22 additions and 1 deletions

View File

@@ -679,6 +679,11 @@ class NewWalletWizard(KeystoreWizard):
addresses[addr] = {'type': txin_type, 'pubkey': pubkey}
elif 'address_list' in data:
for addr in data['address_list'].split():
assert isinstance(addr, str)
assert bitcoin.is_address(addr), f"expected bitcoin addr. got {addr[:5] + '..' + addr[-2:]}"
# note: we do not normalize addresses. :/
# In particular, bech32 addresses can be either all-lowercase or all-uppercase.
# TODO we should normalize them, but it only makes sense if we also do a walletDB-upgrade.
addresses[addr] = {}
elif data['keystore_type'] in ['createseed', 'haveseed']:
seed_extension = data['seed_extra_words'] if data['seed_extend'] else ''