qml: don't duplicate invoice (e.g. when scanned twice)
also add invoice to invoiceModel from python, not qml
This commit is contained in:
@@ -191,10 +191,6 @@ Item {
|
||||
var dialog = lnurlPayDialog.createObject(app, { invoiceParser: invoiceParser })
|
||||
dialog.open()
|
||||
}
|
||||
|
||||
onInvoiceSaved: {
|
||||
Daemon.currentWallet.invoiceModel.addInvoice(key)
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user