1
0

Merge pull request #7778 from SomberNight/202204_invoice_recalc_ids

wallet_db upgrade: recalc keys of outgoing on-chain invoices
This commit is contained in:
ThomasV
2022-04-28 15:12:29 +02:00
committed by GitHub
6 changed files with 65 additions and 43 deletions

View File

@@ -19,7 +19,7 @@ from electrum import util
from electrum.util import (profiler, InvalidPassword, send_exception_to_crash_reporter,
format_satoshis, format_satoshis_plain, format_fee_satoshis,
maybe_extract_bolt11_invoice, parse_max_spend)
from electrum.invoices import PR_PAID, PR_FAILED
from electrum.invoices import PR_PAID, PR_FAILED, Invoice
from electrum import blockchain
from electrum.network import Network, TxBroadcastError, BestEffortRequestFailed
from electrum.interface import PREFERRED_NETWORK_PROTOCOL, ServerAddr
@@ -447,8 +447,7 @@ class ElectrumWindow(App, Logger):
self.show_error(_('No wallet loaded.'))
return
if pr.verify(self.wallet.contacts):
key = pr.get_id()
invoice = self.wallet.get_invoice(key) # FIXME wrong key...
invoice = Invoice.from_bip70_payreq(pr, height=0)
if invoice and self.wallet.get_invoice_status(invoice) == PR_PAID:
self.show_error("invoice already paid")
self.send_screen.do_clear()