tstorage: fix convert_version_18 - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit b134f04fef62991e302185da44b1a53a0984f302
DIR parent 9ecb50473924e89d3792086a078bd34ec2db8458
HTML Author: SomberNight <somber.night@protonmail.com>
Date: Fri, 1 Mar 2019 19:54:09 +0100
storage: fix convert_version_18
Diffstat:
M electrum/json_db.py | 6 ++++++
1 file changed, 6 insertions(+), 0 deletions(-)
---
DIR diff --git a/electrum/json_db.py b/electrum/json_db.py
t@@ -105,6 +105,12 @@ class JsonDB(PrintError):
self.data[key] = copy.deepcopy(value)
return True
elif key in self.data:
+ # clear current contents in case of references
+ cur_val = self.data[key]
+ clear_method = getattr(cur_val, "clear", None)
+ if callable(clear_method):
+ clear_method()
+ # pop from dict to delete key
self.data.pop(key)
return True
return False