1
0

lnworker: fix can_pay_invoice for trampoline MPP

Call it from the GUI
This commit is contained in:
ThomasV
2022-04-09 16:48:27 +02:00
parent d34f513532
commit fb6047ec46
3 changed files with 37 additions and 7 deletions

View File

@@ -1671,8 +1671,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
key = self.wallet.get_key_for_outgoing_invoice(invoice)
if amount_sat is None:
raise Exception("missing amount for LN invoice")
num_sats_can_send = int(self.wallet.lnworker.num_sats_can_send())
if amount_sat > num_sats_can_send:
if not self.wallet.lnworker.can_pay_invoice(invoice):
num_sats_can_send = int(self.wallet.lnworker.num_sats_can_send())
lightning_needed = amount_sat - num_sats_can_send
lightning_needed += (lightning_needed // 20) # operational safety margin
coins = self.get_coins(nonlocal_only=True)