electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 36a444ba6c5d32fb2c89a4549449cfaab75bebcc
parent 180480099926946de19e6f5db8296fc5b56683dc
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:
Mlib/wallet.py | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/wallet.py b/lib/wallet.py @@ -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] @@ -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