diff --git a/electrum/gui/qml/components/WalletMainView.qml b/electrum/gui/qml/components/WalletMainView.qml index a3c0c7785..bc7b256f2 100644 --- a/electrum/gui/qml/components/WalletMainView.qml +++ b/electrum/gui/qml/components/WalletMainView.qml @@ -191,10 +191,6 @@ Item { var dialog = lnurlPayDialog.createObject(app, { invoiceParser: invoiceParser }) dialog.open() } - - onInvoiceSaved: { - Daemon.currentWallet.invoiceModel.addInvoice(key) - } } Component { diff --git a/electrum/gui/qml/qeinvoice.py b/electrum/gui/qml/qeinvoice.py index 1b0c1afe7..ebb5c244b 100644 --- a/electrum/gui/qml/qeinvoice.py +++ b/electrum/gui/qml/qeinvoice.py @@ -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):