From 5a3d05abe2a317d20dabcb4117ac891f81e820be Mon Sep 17 00:00:00 2001 From: PiRK Date: Fri, 12 May 2023 13:06:13 +0200 Subject: [PATCH] guard against loading unsupported contact type 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. --- electrumabc/contacts.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/electrumabc/contacts.py b/electrumabc/contacts.py index 5df956257708..50e9d338792a 100644 --- a/electrumabc/contacts.py +++ b/electrumabc/contacts.py @@ -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))