Browse Source

qml: update history when LN payment arrives

patch-4
Sander van Grieken 2 years ago
parent
commit
5042d9971c
  1. 10
      electrum/gui/qml/qewallet.py

10
electrum/gui/qml/qewallet.py

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

Loading…
Cancel
Save