From 76f795bc9a7429090d1714867e1f069ab3a465d4 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 4 Apr 2023 15:52:18 +0000 Subject: [PATCH] kivy: history screen: fix "future" txs ``` 3.96 | E | gui.kivy.uix.dialogs.crash_reporter.ExceptionHook | exception caught by crash reporter Traceback (most recent call last): File "kivy/_clock.pyx", line 649, in kivy._clock.CyClockBase._process_events File "kivy/_clock.pyx", line 218, in kivy._clock.ClockEvent.tick File "/home/user/wspace/electrum/electrum/gui/kivy/main_window.py", line 1045, in update_wallet self.update_tabs() File "/home/user/wspace/electrum/electrum/util.py", line 462, in return lambda *args, **kw_args: do_profile(args, kw_args) File "/home/user/wspace/electrum/electrum/util.py", line 458, in do_profile o = func(*args, **kw_args) File "/home/user/wspace/electrum/electrum/gui/kivy/main_window.py", line 506, in update_tabs self.update_tab(name) File "/home/user/wspace/electrum/electrum/gui/kivy/main_window.py", line 501, in update_tab s.update() File "/home/user/wspace/electrum/electrum/gui/kivy/uix/screens.py", line 161, in update history_card.data = [self.get_card(item) for item in history] File "/home/user/wspace/electrum/electrum/gui/kivy/uix/screens.py", line 161, in history_card.data = [self.get_card(item) for item in history] File "/home/user/wspace/electrum/electrum/gui/kivy/uix/screens.py", line 132, in get_card status, status_str = self.app.wallet.get_tx_status(tx_hash, tx_mined_info) File "/home/user/wspace/electrum/electrum/wallet.py", line 1491, in get_tx_status num_blocks_remainining = tx_mined_info.wanted_height - self.adb.get_local_height() TypeError: unsupported operand type(s) for -: 'NoneType' and 'int' ``` --- electrum/gui/kivy/uix/screens.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/electrum/gui/kivy/uix/screens.py b/electrum/gui/kivy/uix/screens.py index 6476e2e1a..1d6115138 100644 --- a/electrum/gui/kivy/uix/screens.py +++ b/electrum/gui/kivy/uix/screens.py @@ -126,9 +126,12 @@ class HistoryScreen(CScreen): fee_text = '' if fee is None else 'fee: %d sat'%fee else: tx_hash = tx_item['txid'] - tx_mined_info = TxMinedInfo(height=tx_item['height'], - conf=tx_item['confirmations'], - timestamp=tx_item['timestamp']) + tx_mined_info = TxMinedInfo( + height=tx_item['height'], + conf=tx_item['confirmations'], + timestamp=tx_item['timestamp'], + wanted_height=tx_item.get('wanted_height', None), + ) status, status_str = self.app.wallet.get_tx_status(tx_hash, tx_mined_info) icon = f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/' + TX_ICONS[status] message = tx_item['label'] or tx_hash