diff --git a/electrum/lnworker.py b/electrum/lnworker.py index d00455266..746e009a5 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -1808,7 +1808,7 @@ class LNWallet(LNWorker): amount_msat: Optional[int], message: str, expiry: int, - fallback_address: str, + fallback_address: Optional[str], write_to_disk: bool = True, channels: Optional[Sequence[Channel]] = None, ) -> Tuple[LnAddr, str]: @@ -1848,10 +1848,16 @@ class LNWallet(LNWorker): self.wallet.save_db() return lnaddr, invoice - def add_request(self, amount_sat: Optional[int], message:str, expiry: int, fallback_address:str) -> str: + def add_request( + self, + *, + amount_sat: Optional[int], + message: str, + expiry: int, + fallback_address: Optional[str], + ) -> str: # passed expiry is relative, it is absolute in the lightning invoice amount_msat = amount_sat * 1000 if amount_sat else None - timestamp = int(time.time()) lnaddr, invoice = self.create_invoice( amount_msat=amount_msat, message=message, diff --git a/electrum/wallet.py b/electrum/wallet.py index bfbd2a6c1..c2280b29d 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -2438,7 +2438,15 @@ class Abstract_Wallet(ABC, Logger, EventListener): exp_delay = exp_delay or 0 timestamp = int(time.time()) fallback_address = address if self.config.get('bolt11_fallback', True) else None - lightning_invoice = self.lnworker.add_request(amount_sat, message, exp_delay, fallback_address) if lightning else None + if lightning: + lightning_invoice = self.lnworker.add_request( + amount_sat=amount_sat, + message=message, + expiry=exp_delay, + fallback_address=fallback_address, + ) + else: + lightning_invoice = None outputs = [ PartialTxOutput.from_address_and_value(address, amount_sat)] if address else [] height = self.adb.get_local_height() req = Invoice(