mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
Merge pull request #3950 from SomberNight/wallet_locks_3949
locks in wallet
This commit is contained in:
commit
36a444ba6c
1 changed files with 6 additions and 2 deletions
|
@ -718,7 +718,9 @@ class Abstract_Wallet(PrintError):
|
||||||
|
|
||||||
def get_address_history(self, addr):
|
def get_address_history(self, addr):
|
||||||
h = []
|
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:
|
for tx_hash in self.transactions:
|
||||||
if addr in self.txi.get(tx_hash, []) or addr in self.txo.get(tx_hash, []):
|
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]
|
tx_height = self.get_tx_height(tx_hash)[0]
|
||||||
|
@ -775,7 +777,9 @@ class Abstract_Wallet(PrintError):
|
||||||
return conflicting_txns
|
return conflicting_txns
|
||||||
|
|
||||||
def add_transaction(self, tx_hash, tx):
|
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
|
# 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
|
# 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
|
# of add_transaction tx, we might learn of more-and-more inputs of
|
||||||
|
|
Loading…
Add table
Reference in a new issue