invoices: don't modify .amount_msat directly
This commit is contained in:
@@ -351,7 +351,7 @@ class SendScreen(CScreen, Logger):
|
||||
assert type(amount_sat) is int
|
||||
invoice = Invoice.from_bech32(address)
|
||||
if invoice.amount_msat is None:
|
||||
invoice.amount_msat = int(amount_sat * 1000)
|
||||
invoice.set_amount_msat(int(amount_sat * 1000))
|
||||
return invoice
|
||||
else:
|
||||
# on-chain
|
||||
|
||||
@@ -379,8 +379,7 @@ class QEInvoice(QObject, QtEventListener):
|
||||
if self.amount.isEmpty:
|
||||
if self.amountOverride.isEmpty:
|
||||
raise Exception('can not pay 0 amount')
|
||||
# TODO: is update amount_msat for overrideAmount sufficient?
|
||||
self._effectiveInvoice.amount_msat = self.amountOverride.satsInt * 1000
|
||||
self._effectiveInvoice.set_amount_msat(self.amountOverride.satsInt * 1000)
|
||||
|
||||
self._wallet.pay_lightning_invoice(self._effectiveInvoice)
|
||||
|
||||
@@ -627,9 +626,9 @@ class QEInvoiceParser(QEInvoice):
|
||||
|
||||
if not self._effectiveInvoice.amount_msat and not self.amountOverride.isEmpty:
|
||||
if self.invoiceType == QEInvoice.Type.OnchainInvoice and self.amountOverride.isMax:
|
||||
self._effectiveInvoice.amount_msat = '!'
|
||||
self._effectiveInvoice.set_amount_msat('!')
|
||||
else:
|
||||
self._effectiveInvoice.amount_msat = self.amountOverride.satsInt * 1000
|
||||
self._effectiveInvoice.set_amount_msat(self.amountOverride.satsInt * 1000)
|
||||
|
||||
self.canSave = False
|
||||
|
||||
|
||||
@@ -606,7 +606,7 @@ class ElectrumGui(BaseElectrumGui, EventListener):
|
||||
if invoice.amount_msat is None:
|
||||
amount_sat = self.parse_amount(self.str_amount)
|
||||
if amount_sat:
|
||||
invoice.amount_msat = int(amount_sat * 1000)
|
||||
invoice.set_amount_msat(int(amount_sat * 1000))
|
||||
else:
|
||||
self.show_error(_('No amount'))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user