electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit aa37979100b9119414026862444bfdb13295e6d3
parent b9cf095e1a0e44121fd4f3b1861c14ff82d36931
Author: ThomasV <thomasv@electrum.org>
Date:   Mon, 18 Nov 2019 10:22:20 +0100

fix #5761

Diffstat:
Melectrum/gui/qt/main_window.py | 5++---
Melectrum/lnworker.py | 5++---
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py @@ -1390,8 +1390,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): return False # no errors - def pay_lightning_invoice(self, invoice): - amount_sat = self.amount_e.get_amount() + def pay_lightning_invoice(self, invoice, amount_sat=None): attempts = LN_NUM_PAYMENT_ATTEMPTS def task(): self.wallet.lnworker.pay(invoice, amount_sat, attempts) @@ -1469,7 +1468,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): def do_pay_invoice(self, invoice): if invoice['type'] == PR_TYPE_LN: - self.pay_lightning_invoice(invoice['invoice']) + self.pay_lightning_invoice(invoice['invoice'], amount_sat=invoice['amount']) elif invoice['type'] == PR_TYPE_ONCHAIN: outputs = invoice['outputs'] self.pay_onchain_dialog(self.get_coins(), outputs, invoice=invoice) diff --git a/electrum/lnworker.py b/electrum/lnworker.py @@ -845,10 +845,10 @@ class LNWallet(LNWorker): @log_exceptions async def _pay(self, invoice, amount_sat=None, attempts=1): - lnaddr = lndecode(invoice, expected_hrp=constants.net.SEGWIT_HRP) + lnaddr = self._check_invoice(invoice, amount_sat) payment_hash = lnaddr.paymenthash key = payment_hash.hex() - amount = int(lnaddr.amount * COIN) if lnaddr.amount else None + amount = int(lnaddr.amount * COIN) status = self.get_payment_status(payment_hash) if status == PR_PAID: raise PaymentFailure(_("This invoice has been paid already")) @@ -856,7 +856,6 @@ class LNWallet(LNWorker): raise PaymentFailure(_("A payment was already initiated for this invoice")) info = PaymentInfo(lnaddr.paymenthash, amount, SENT, PR_UNPAID) self.save_payment_info(info) - self._check_invoice(invoice, amount_sat) self.wallet.set_label(key, lnaddr.get_description()) log = self.logs[key] for i in range(attempts):