From 68581ce80a6c0bc80beb8050eb8eccfe8ef0ef65 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Sun, 10 Jul 2022 16:08:02 +0200 Subject: [PATCH] invoices: fix type hint for get_address() --- electrum/invoices.py | 2 +- electrum/wallet.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/electrum/invoices.py b/electrum/invoices.py index 268d657fc..b15b6661d 100644 --- a/electrum/invoices.py +++ b/electrum/invoices.py @@ -117,7 +117,7 @@ class Invoice(StoredObject): status_str = _('Expires') + ' ' + age(expiration, include_seconds=True) return status_str - def get_address(self) -> str: + def get_address(self) -> Optional[str]: """returns the first address, to be displayed in GUI""" if self.is_lightning(): return self._lnaddr.get_fallback_address() or None diff --git a/electrum/wallet.py b/electrum/wallet.py index 6754de23d..9f877ead2 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -2474,7 +2474,7 @@ class Abstract_Wallet(ABC, Logger, EventListener): """Return the key to use for this invoice in self.receive_requests.""" # FIXME: this should be a method of Invoice if not req.is_lightning(): - addr = req.get_address() + addr = req.get_address() or "" if sanity_checks: if not bitcoin.is_address(addr): raise Exception(_('Invalid Bitcoin address.'))