1
0

qml: update history when LN payment arrives

This commit is contained in:
Sander van Grieken
2022-10-17 11:34:32 +02:00
parent 4b8790c919
commit 5042d9971c

View File

@@ -8,7 +8,7 @@ from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QTimer
from electrum import bitcoin
from electrum.i18n import _
from electrum.invoices import InvoiceError, PR_DEFAULT_EXPIRATION_WHEN_CREATING
from electrum.invoices import InvoiceError, PR_DEFAULT_EXPIRATION_WHEN_CREATING, PR_PAID
from electrum.logging import get_logger
from electrum.network import TxBroadcastError, BestEffortRequestFailed
from electrum.transaction import PartialTxOutput
@@ -145,11 +145,17 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
self.synchronizing_progress = ''
self.synchronizing = False
@event_listener
@qt_event_listener
def on_event_request_status(self, wallet, key, status):
if wallet == self.wallet:
self._logger.debug('request status %d for key %s' % (status, key))
self.requestStatusChanged.emit(key, status)
if status == PR_PAID:
# might be new incoming LN payment, update history
# TODO: only update if it was paid over lightning,
# and even then, we can probably just add the payment instead
# of recreating the whole history (expensive)
self.historyModel.init_model()
@event_listener
def on_event_invoice_status(self, wallet, key):