From 47f1a2d7a2805139358ea25f1d819467438ebfa5 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 9 Sep 2025 17:24:59 +0000 Subject: [PATCH] wallet.get_full_history: rm "include_fiat" arg, infer it from fx ref https://github.com/spesmilo/electrum/pull/10209#discussion_r2334228490 --- electrum/gui/qml/qetransactionlistmodel.py | 1 - electrum/gui/qt/history_list.py | 5 ++--- electrum/wallet.py | 7 ++++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/electrum/gui/qml/qetransactionlistmodel.py b/electrum/gui/qml/qetransactionlistmodel.py index 20d502951..c693ec482 100644 --- a/electrum/gui/qml/qetransactionlistmodel.py +++ b/electrum/gui/qml/qetransactionlistmodel.py @@ -214,7 +214,6 @@ class QETransactionListModel(QAbstractListModel, QtEventListener): history = self.wallet.get_full_history( onchain_domain=self.onchain_domain, include_lightning=self.include_lightning, - include_fiat=False, ) txs = [] for key, tx in history.items(): diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py index d041c99e2..ee8474ef0 100644 --- a/electrum/gui/qt/history_list.py +++ b/electrum/gui/qt/history_list.py @@ -298,10 +298,9 @@ class HistoryModel(CustomModel, Logger): wallet = self.window.wallet self.set_visibility_of_columns() transactions = wallet.get_full_history( - self.window.fx, + fx=self.window.fx if self.should_show_fiat() else None, onchain_domain=self.get_domain(), include_lightning=self.should_include_lightning_payments(), - include_fiat=self.should_show_fiat(), ) old_length = self._root.childCount() if old_length != 0: @@ -853,7 +852,7 @@ class HistoryList(MyTreeView, AcceptFileDragDrop): self.main_window.show_message(_("Your wallet history has been successfully exported.")) def do_export_history(self, file_name, is_csv): - txns = self.wallet.get_full_history(fx=self.main_window.fx, include_fiat=self.main_window.fx.is_enabled()) + txns = self.wallet.get_full_history(fx=self.main_window.fx if self.hm.should_show_fiat() else None) lines = [] def get_all_fees_paid_by_item(h_item: dict) -> Tuple[int, Fiat]: diff --git a/electrum/wallet.py b/electrum/wallet.py index 9c21594c3..e997e9bfb 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -1427,16 +1427,16 @@ class Abstract_Wallet(ABC, Logger, EventListener): @profiler def get_full_history( self, - fx=None, *, + fx: 'FxThread' = None, # used for fiat values if set onchain_domain=None, include_lightning=True, - include_fiat=False ) -> OrderedDictWithIndex: """ includes both onchain and lightning includes grouping information """ + include_fiat = fx is not None and fx.has_history() transactions_tmp = OrderedDictWithIndex() # add on-chain txns onchain_history = self.get_onchain_history(domain=onchain_domain) @@ -1476,7 +1476,6 @@ class Abstract_Wallet(ABC, Logger, EventListener): if parent is None: parent = { 'label': group_label, - 'fiat_value': Fiat(Decimal(0), fx.ccy) if fx else None, 'bc_value': Satoshis(0), 'ln_value': Satoshis(0), 'value': Satoshis(0), @@ -1489,6 +1488,8 @@ class Abstract_Wallet(ABC, Logger, EventListener): 'confirmations': 0, 'txid': '----', } + if include_fiat: + parent['fiat_value'] = Fiat(Decimal(0), fx.ccy) transactions[key] = parent parent['bc_value'] += tx_item['bc_value'] parent['ln_value'] += tx_item['ln_value']