twallet.py: access verified_tx with lock - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit ee9861f0d53c6e232828a5999e1abf8773113da5 DIR parent 6bb7558f7546433c8b978270ccb984195b1c62be HTML Author: SomberNight <somber.night@protonmail.com> Date: Wed, 30 May 2018 13:24:58 +0200 wallet.py: access verified_tx with lock Diffstat: M lib/wallet.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -442,7 +442,8 @@ class Abstract_Wallet(PrintError): def add_unverified_tx(self, tx_hash, tx_height): if tx_height in (TX_HEIGHT_UNCONFIRMED, TX_HEIGHT_UNCONF_PARENT) \ and tx_hash in self.verified_tx: - self.verified_tx.pop(tx_hash) + with self.lock: + self.verified_tx.pop(tx_hash) if self.verifier: self.verifier.merkle_roots.pop(tx_hash, None) t@@ -1321,7 +1322,8 @@ class Abstract_Wallet(PrintError): # remain so they will be GC-ed self.storage.put('stored_height', self.get_local_height()) self.save_transactions() - self.storage.put('verified_tx3', self.verified_tx) + with self.lock: + self.storage.put('verified_tx3', self.verified_tx) self.storage.write() def wait_until_synchronized(self, callback=None): t@@ -1963,8 +1965,7 @@ class Imported_Wallet(Simple_Wallet): self.unverified_tx.pop(tx_hash, None) self.transactions.pop(tx_hash, None) # FIXME: what about pruned_txo? - - self.storage.put('verified_tx3', self.verified_tx) + self.storage.put('verified_tx3', self.verified_tx) self.save_transactions() self.set_label(address, None)