1
0

qml: don't duplicate invoice (e.g. when scanned twice)

also add invoice to invoiceModel from python, not qml
This commit is contained in:
Sander van Grieken
2022-10-17 15:44:27 +02:00
parent f64d344dcd
commit 0c163a5322
2 changed files with 7 additions and 7 deletions

View File

@@ -191,10 +191,6 @@ Item {
var dialog = lnurlPayDialog.createObject(app, { invoiceParser: invoiceParser })
dialog.open()
}
onInvoiceSaved: {
Daemon.currentWallet.invoiceModel.addInvoice(key)
}
}
Component {

View File

@@ -490,10 +490,14 @@ class QEInvoiceParser(QEInvoice):
self.canSave = False
if not self._effectiveInvoice:
return
# TODO detect duplicate?
self.key = self._effectiveInvoice.get_id()
self._wallet.wallet.save_invoice(self._effectiveInvoice)
self.invoiceSaved.emit(self.key)
if self._wallet.wallet.get_invoice(self.key):
self._logger.info(f'invoice {self.key} already exists')
else:
self._wallet.wallet.save_invoice(self._effectiveInvoice)
self._wallet.invoiceModel.addInvoice(self.key)
self.invoiceSaved.emit(self.key)
class QEUserEnteredPayment(QEInvoice):