only cache expensive case

This commit is contained in:
SomberNight 2018-03-06 17:15:14 +01:00
parent db0e3cd209
commit e0cda39ae5

View file

@ -1765,15 +1765,15 @@ class Abstract_Wallet(PrintError):
return result return result
if self.txi.get(txid, {}) != {}: if self.txi.get(txid, {}) != {}:
result = self.average_price(txid, price_func, ccy) * txin_value/Decimal(COIN) result = self.average_price(txid, price_func, ccy) * txin_value/Decimal(COIN)
self.coin_price_cache[cache_key] = result
return result
else: else:
fiat_value = self.get_fiat_value(txid, ccy) fiat_value = self.get_fiat_value(txid, ccy)
if fiat_value is not None: if fiat_value is not None:
result = fiat_value return fiat_value
else: else:
p = self.price_at_timestamp(txid, price_func) p = self.price_at_timestamp(txid, price_func)
result = p * txin_value/Decimal(COIN) return p * txin_value/Decimal(COIN)
self.coin_price_cache[cache_key] = result
return result
class Simple_Wallet(Abstract_Wallet): class Simple_Wallet(Abstract_Wallet):