wallet.get_full_history: rm "include_fiat" arg, infer it from fx

ref https://github.com/spesmilo/electrum/pull/10209#discussion_r2334228490
This commit is contained in:
SomberNight
2025-09-09 17:24:59 +00:00
parent df45233c2f
commit 47f1a2d7a2
3 changed files with 6 additions and 7 deletions

View File

@@ -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():

View File

@@ -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]:

View File

@@ -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']