commit e12af33626622809640fc29804e0ef14ae3dfb9b
parent 4a7ce238fd312d5ed78fdcce92beec7f2f37ebb4
Author: SomberNight <somber.night@protonmail.com>
Date: Wed, 28 Nov 2018 12:35:53 +0100
wallet: cache more in get_tx_fee
closes #4879
Diffstat:
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/electrum/address_synchronizer.py b/electrum/address_synchronizer.py
@@ -717,12 +717,15 @@ class AddressSynchronizer(PrintError):
return None
if hasattr(tx, '_cached_fee'):
return tx._cached_fee
- is_relevant, is_mine, v, fee = self.get_wallet_delta(tx)
- if fee is None:
- txid = tx.txid()
- fee = self.tx_fees.get(txid)
- if fee is not None:
- tx._cached_fee = fee
+ with self.lock, self.transaction_lock:
+ is_relevant, is_mine, v, fee = self.get_wallet_delta(tx)
+ if fee is None:
+ txid = tx.txid()
+ fee = self.tx_fees.get(txid)
+ # cache fees. if wallet is synced, cache all;
+ # otherwise only cache non-None, as None can still change while syncing
+ if self.up_to_date or fee is not None:
+ tx._cached_fee = fee
return fee
def get_addr_io(self, address):