commit 2fd4cdcaa9f59dae56d17fa0d9864eefc3ff89e9
parent 943d1ba8f2ee8e0a0ea80be4fc67f6d304727b67
Author: ThomasV <thomasv@electrum.org>
Date: Thu, 28 Feb 2019 16:11:19 +0100
json_db: add missing lock
Diffstat:
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/electrum/json_db.py b/electrum/json_db.py
@@ -105,6 +105,7 @@ class JsonDB(PrintError):
def commit(self):
pass
+ @locked
def dump(self):
return json.dumps(self.data, indent=4, sort_keys=True, cls=util.MyEncoder)
@@ -659,19 +660,16 @@ class JsonDB(PrintError):
self.history = self.get_data_ref('addr_history') # address -> list(txid, height)
self.verified_tx = self.get_data_ref('verified_tx3') # txid -> TxMinedInfo. Access with self.lock.
self.tx_fees = self.get_data_ref('tx_fees')
-
# convert list to set
for t in self.txi, self.txo:
for d in t.values():
for addr, lst in d.items():
d[addr] = set([tuple(x) for x in lst])
-
# remove unreferenced tx
for tx_hash in list(self.transactions.keys()):
if not self.get_txi(tx_hash) and not self.get_txo(tx_hash):
self.print_error("removing unreferenced tx", tx_hash)
self.transactions.pop(tx_hash)
-
# remove unreferenced outpoints
for prevout_hash in self.spent_outpoints.keys():
d = self.spent_outpoints[prevout_hash]