mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 18:25:21 +00:00
qt: fix address dialog
(was showing full history, not just for addr)
This commit is contained in:
parent
a1d7d39f68
commit
6a32187f01
4 changed files with 22 additions and 10 deletions
|
@ -430,7 +430,7 @@ class AddressSynchronizer(Logger):
|
|||
return f
|
||||
|
||||
@with_local_height_cached
|
||||
def get_history(self, domain=None) -> Sequence[HistoryItem]:
|
||||
def get_history(self, *, domain=None) -> Sequence[HistoryItem]:
|
||||
# get domain
|
||||
if domain is None:
|
||||
domain = self.get_addresses()
|
||||
|
|
|
@ -45,6 +45,9 @@ class AddressHistoryModel(HistoryModel):
|
|||
def get_domain(self):
|
||||
return [self.address]
|
||||
|
||||
def should_include_lightning_payments(self) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
class AddressDialog(WindowModalDialog):
|
||||
|
||||
|
|
|
@ -252,9 +252,13 @@ class HistoryModel(QAbstractItemModel, Logger):
|
|||
self.parent.utxo_list.update()
|
||||
|
||||
def get_domain(self):
|
||||
'''Overridden in address_dialog.py'''
|
||||
"""Overridden in address_dialog.py"""
|
||||
return self.parent.wallet.get_addresses()
|
||||
|
||||
def should_include_lightning_payments(self) -> bool:
|
||||
"""Overridden in address_dialog.py"""
|
||||
return True
|
||||
|
||||
@profiler
|
||||
def refresh(self, reason: str):
|
||||
self.logger.info(f"refreshing... reason: {reason}")
|
||||
|
@ -268,7 +272,9 @@ class HistoryModel(QAbstractItemModel, Logger):
|
|||
if fx: fx.history_used_spot = False
|
||||
wallet = self.parent.wallet
|
||||
self.set_visibility_of_columns()
|
||||
transactions = wallet.get_full_history(self.parent.fx)
|
||||
transactions = wallet.get_full_history(self.parent.fx,
|
||||
onchain_domain=self.get_domain(),
|
||||
include_lightning=self.should_include_lightning_payments())
|
||||
if transactions == list(self.transactions.values()):
|
||||
return
|
||||
old_length = len(self.transactions)
|
||||
|
@ -690,6 +696,7 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
|||
self.parent.show_message(_("Your wallet history has been successfully exported."))
|
||||
|
||||
def do_export_history(self, file_name, is_csv):
|
||||
# FIXME this is currently broken.
|
||||
hist = self.wallet.get_full_history(domain=self.hm.get_domain(),
|
||||
from_timestamp=None,
|
||||
to_timestamp=None,
|
||||
|
|
|
@ -487,7 +487,7 @@ class Abstract_Wallet(AddressSynchronizer):
|
|||
def balance_at_timestamp(self, domain, target_timestamp):
|
||||
# we assume that get_history returns items ordered by block height
|
||||
# we also assume that block timestamps are monotonic (which is false...!)
|
||||
h = self.get_history(domain)
|
||||
h = self.get_history(domain=domain)
|
||||
balance = 0
|
||||
for hist_item in h:
|
||||
balance = hist_item.balance
|
||||
|
@ -496,8 +496,8 @@ class Abstract_Wallet(AddressSynchronizer):
|
|||
# return last balance
|
||||
return balance
|
||||
|
||||
def get_onchain_history(self):
|
||||
for hist_item in self.get_history():
|
||||
def get_onchain_history(self, *, domain=None):
|
||||
for hist_item in self.get_history(domain=domain):
|
||||
yield {
|
||||
'txid': hist_item.txid,
|
||||
'fee_sat': hist_item.fee,
|
||||
|
@ -584,15 +584,17 @@ class Abstract_Wallet(AddressSynchronizer):
|
|||
if self.lnworker:
|
||||
return self.lnworker.get_request(key)
|
||||
|
||||
|
||||
@profiler
|
||||
def get_full_history(self, fx=None):
|
||||
def get_full_history(self, fx=None, *, onchain_domain=None, include_lightning=True):
|
||||
transactions = OrderedDictWithIndex()
|
||||
onchain_history = self.get_onchain_history()
|
||||
onchain_history = self.get_onchain_history(domain=onchain_domain)
|
||||
for tx_item in onchain_history:
|
||||
txid = tx_item['txid']
|
||||
transactions[txid] = tx_item
|
||||
lightning_history = self.lnworker.get_history() if self.lnworker else []
|
||||
if self.lnworker and include_lightning:
|
||||
lightning_history = self.lnworker.get_history()
|
||||
else:
|
||||
lightning_history = []
|
||||
|
||||
for i, tx_item in enumerate(lightning_history):
|
||||
txid = tx_item.get('txid')
|
||||
|
|
Loading…
Add table
Reference in a new issue