1
0

wallet: fix paying invoice with "max" amount

fixes https://github.com/spesmilo/electrum/pull/7774
This commit is contained in:
SomberNight
2022-04-22 16:46:47 +02:00
parent 7be8b4f405
commit 63c8aeb54c

View File

@@ -776,13 +776,13 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
height=self.get_local_height() height=self.get_local_height()
if pr: if pr:
return Invoice.from_bip70_payreq(pr, height) return Invoice.from_bip70_payreq(pr, height)
amount = 0 amount_msat = 0
for x in outputs: for x in outputs:
if parse_max_spend(x.value): if parse_max_spend(x.value):
amount = '!' amount_msat = '!'
break break
else: else:
amount += x.value amount_msat += x.value * 1000
timestamp = None timestamp = None
exp = None exp = None
if URI: if URI:
@@ -791,7 +791,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
timestamp = timestamp or int(time.time()) timestamp = timestamp or int(time.time())
exp = exp or 0 exp = exp or 0
invoice = Invoice( invoice = Invoice(
amount_msat=amount*1000, amount_msat=amount_msat,
message=message, message=message,
time=timestamp, time=timestamp,
exp=exp, exp=exp,