Browse Source

jsondb: raise when trying to store sets in the db

Some generic protection to prevent bugs similar to what was just fixed in prev commits.
related https://github.com/spesmilo/electrum/issues/8842
master
SomberNight 2 years ago
parent
commit
1734042293
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 3
      electrum/json_db.py

3
electrum/json_db.py

@ -159,6 +159,9 @@ class StoredDict(dict):
# convert lists
if isinstance(v, list):
v = StoredList(v, self.db, self.path + [key])
# reject sets. they do not work well with jsonpatch
if isinstance(v, set):
raise Exception(f"Do not store sets inside jsondb. path={self.path!r}")
# set item
dict.__setitem__(self, key, v)
if self.db and patch:

Loading…
Cancel
Save