tMerge pull request #3950 from SomberNight/wallet_locks_3949 - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 36a444ba6c5d32fb2c89a4549449cfaab75bebcc DIR parent 180480099926946de19e6f5db8296fc5b56683dc HTML Author: ThomasV <thomasv@electrum.org> Date: Wed, 21 Feb 2018 17:18:58 +0100 Merge pull request #3950 from SomberNight/wallet_locks_3949 locks in wallet Diffstat: M lib/wallet.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -718,7 +718,9 @@ class Abstract_Wallet(PrintError): def get_address_history(self, addr): h = [] - with self.transaction_lock: + # we need self.transaction_lock but get_tx_height will take self.lock + # so we need to take that too here, to enforce order of locks + with self.lock, self.transaction_lock: for tx_hash in self.transactions: if addr in self.txi.get(tx_hash, []) or addr in self.txo.get(tx_hash, []): tx_height = self.get_tx_height(tx_hash)[0] t@@ -775,7 +777,9 @@ class Abstract_Wallet(PrintError): return conflicting_txns def add_transaction(self, tx_hash, tx): - with self.transaction_lock: + # we need self.transaction_lock but get_tx_height will take self.lock + # so we need to take that too here, to enforce order of locks + with self.lock, self.transaction_lock: # NOTE: returning if tx in self.transactions might seem like a good idea # BUT we track is_mine inputs in a txn, and during subsequent calls # of add_transaction tx, we might learn of more-and-more inputs of