diff --git a/lib/wallet.py b/lib/wallet.py index 57768d80c5d4..c5442000e141 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -1933,13 +1933,20 @@ def fmt_slp_amt(v, decimals): if v is None: return '--' if decimals == "?": - return '?' + decimals = 0 return format_satoshis(v, decimal_point=int(decimals), is_diff=True) + def get_token_info(token_id): + return self.token_types.get(token_id, { + 'class': '?', + 'decimals': 0, + 'name': 'unknown' + }) + slp_h = dict((tx_hash, { \ - 'value': fmt_slp_amt(delta, self.token_types[token_id]['decimals']), \ + 'value': fmt_slp_amt(delta, get_token_info(token_id)['decimals']), \ 'token_id': token_id, \ - 'name': self.token_types[token_id]['name'] \ + 'name': get_token_info(token_id)['name'] \ }) for tx_hash, _, _, _, delta, token_id in _slp_h) def get_slp_tx(tx_hash):