1
0

invoices: only skip generating BIP21 URI for payment request if both amount and message are empty.

This will result in only showing a bare address QR in the GUIs iff both amount and message are left empty.
This commit is contained in:
Sander van Grieken
2025-05-14 13:59:27 +02:00
parent e06e2c0ba4
commit acaaaa00ca
2 changed files with 7 additions and 5 deletions

View File

@@ -344,10 +344,11 @@ class Request(BaseInvoice):
) -> Optional[str]:
addr = self.get_address()
amount = self.get_amount_sat()
if amount is None:
return
amount = int(amount)
message = self.message
if amount is None and not message:
return
if amount:
amount = int(amount)
extra = {}
if self.time and self.exp:
extra['time'] = str(int(self.time))