commit cf866adfe3063f3603be28216606d9448ad0da19
parent 0603f9f2b4c6e23fbe9dc0bf79803a86f9aea9e5
Author: ThomasV <thomasv@electrum.org>
Date: Mon, 12 Mar 2018 10:30:56 +0100
fix #4109
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/wallet.py b/lib/wallet.py
@@ -1737,11 +1737,12 @@ class Abstract_Wallet(PrintError):
def txin_value(self, txin):
txid = txin['prevout_hash']
prev_n = txin['prevout_n']
- for address, d in self.txo[txid].items():
+ for address, d in self.txo.get(txid, {}).items():
for n, v, cb in d:
if n == prev_n:
return v
- raise BaseException('unknown txin value')
+ # may occur if wallet is not synchronized
+ return None
def price_at_timestamp(self, txid, price_func):
height, conf, timestamp = self.get_tx_height(txid)
@@ -1770,6 +1771,8 @@ class Abstract_Wallet(PrintError):
Acquisition price of a coin.
This assumes that either all inputs are mine, or no input is mine.
"""
+ if txin_value is None:
+ return Decimal('NaN')
cache_key = "{}:{}:{}".format(str(txid), str(ccy), str(txin_value))
result = self.coin_price_cache.get(cache_key, None)
if result is not None: