twallet: don't cache NaN coin price - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit 73e367dc3bbef3e9dcc6d1f524e109c0a30f6a1d
DIR parent 0da1e904fecc983ecb38cf3f43ee5dc2c933c822
HTML Author: Janus <ysangkok@gmail.com>
Date: Wed, 5 Sep 2018 14:38:43 +0200
wallet: don't cache NaN coin price
if NaN coin price is cached, historial acquisition prices are not shown
correctly since the historial prices are requested after the full
history is initially shown. As such, "No data" will be shown, even
tthough the user required using historical pricing.
Diffstat:
M electrum/wallet.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
DIR diff --git a/electrum/wallet.py b/electrum/wallet.py
t@@ -1129,7 +1129,8 @@ class Abstract_Wallet(AddressSynchronizer):
return result
if self.txi.get(txid, {}) != {}:
result = self.average_price(txid, price_func, ccy) * txin_value/Decimal(COIN)
- self.coin_price_cache[cache_key] = result
+ if not result.is_nan():
+ self.coin_price_cache[cache_key] = result
return result
else:
fiat_value = self.get_fiat_value(txid, ccy)