1
0

Persist LNWatcher transactions in wallet file:

- separate AddressSynchronizer from Wallet and LNWatcher
 - the AddressSynchronizer class is referred to as 'adb' (address database)
 - Use callbacks to replace overloaded methods
This commit is contained in:
ThomasV
2022-06-01 23:03:35 +02:00
parent b6de15b95d
commit 121d8732f1
23 changed files with 439 additions and 366 deletions

View File

@@ -957,7 +957,7 @@ class ElectrumWindow(App, Logger):
server_height = self.network.get_server_height()
server_lag = self.num_blocks - server_height
if not self.wallet.is_up_to_date() or server_height == 0:
num_sent, num_answered = self.wallet.get_history_sync_state_details()
num_sent, num_answered = self.wallet.adb.get_history_sync_state_details()
status = ("{} [size=18dp]({}/{})[/size]"
.format(_("Synchronizing..."), num_answered, num_sent))
elif server_lag > 1:
@@ -1164,7 +1164,7 @@ class ElectrumWindow(App, Logger):
def show_transaction(self, txid):
tx = self.wallet.db.get_transaction(txid)
if not tx and self.wallet.lnworker:
tx = self.wallet.lnworker.lnwatcher.db.get_transaction(txid)
tx = self.wallet.adb.get_transaction(txid)
if tx:
self.tx_dialog(tx)
else:

View File

@@ -264,7 +264,7 @@ class AddressesDialog(Factory.Popup):
for address in _list:
label = wallet.get_label(address)
balance = sum(wallet.get_addr_balance(address))
is_used_and_empty = wallet.is_used(address) and balance == 0
is_used_and_empty = wallet.adb.is_used(address) and balance == 0
if self.show_used == 1 and (balance or is_used_and_empty):
continue
if self.show_used == 2 and balance == 0:

View File

@@ -168,7 +168,7 @@ class RequestDialog(Factory.Popup):
address = req.get_address()
if not address:
warning = _('Warning') + ': ' + _('This request cannot be paid on-chain')
elif self.app.wallet.is_used(address):
elif self.app.wallet.adb.is_used(address):
warning = _('Warning') + ': ' + _('This address is being reused')
self.warning = warning

View File

@@ -102,7 +102,7 @@ class HistoryScreen(CScreen):
self.app.lightning_tx_dialog(tx_item)
return
if tx_item.get('lightning'):
tx = self.app.wallet.lnworker.lnwatcher.db.get_transaction(key)
tx = self.app.wallet.adb.get_transaction(key)
else:
tx = self.app.wallet.db.get_transaction(key)
if not tx: