Skip to content

Commit

Permalink
guard against loading unsupported contact type
Browse files Browse the repository at this point in the history
This should fix #287. An old (pre-eCash) wallet file could contain CashAcount contacts, and when I removed the CashAccount feature in #249 I did not guard against loading such contacts from the wallet file.
  • Loading branch information
PiRK committed May 12, 2023
1 parent 6e15b62 commit 5a3d05a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions electrumabc/contacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def _load_v2_list(in_list):
name, address, typ = d.get("name"), d.get("address"), d.get("type")
if not all(isinstance(a, str) for a in (name, address, typ)):
continue # skip invalid-looking data
# Filter out invalid or no longer supported types (e.g cashacct)
if typ not in contact_types:
continue
if typ == "address" and not Address.is_valid(address):
continue
out.append(Contact(name, address, typ))
Expand Down

0 comments on commit 5a3d05a

Please sign in to comment.