receive_tab: better help text if lightning peers are disconnected
This commit is contained in:
@@ -1274,20 +1274,24 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
|||||||
def show_receive_request(self, req):
|
def show_receive_request(self, req):
|
||||||
addr = req.get_address() or ''
|
addr = req.get_address() or ''
|
||||||
address_help = '' if addr else _('Amount too small to be received onchain')
|
address_help = '' if addr else _('Amount too small to be received onchain')
|
||||||
can_receive_lightning = self.wallet.lnworker and req.get_amount_sat() <= self.wallet.lnworker.num_sats_can_receive()
|
lnaddr = req.lightning_invoice
|
||||||
lnaddr = req.lightning_invoice if can_receive_lightning else None
|
|
||||||
bip21_lightning = lnaddr if self.config.get('bip21_lightning', False) else None
|
bip21_lightning = lnaddr if self.config.get('bip21_lightning', False) else None
|
||||||
URI = req.get_bip21_URI(lightning=bip21_lightning)
|
URI = req.get_bip21_URI(lightning=bip21_lightning)
|
||||||
lnaddr = lnaddr or ''
|
lightning_online = self.wallet.lnworker and self.wallet.lnworker.num_peers() > 0
|
||||||
icon_name = "lightning.png" if can_receive_lightning else "lightning_disconnected.png"
|
can_receive_lightning = self.wallet.lnworker and req.get_amount_sat() <= self.wallet.lnworker.num_sats_can_receive()
|
||||||
if not lnaddr:
|
if lnaddr is None:
|
||||||
if can_receive_lightning:
|
ln_help = _('This request does not have a Lightning invoice.')
|
||||||
ln_help = _('No lightning invoice')
|
lnaddr = ''
|
||||||
else:
|
elif not lightning_online:
|
||||||
ln_help = _('You do not have the capacity to receive this amount using Lightning')
|
ln_help = _('You must be online to receive Lightning payments.')
|
||||||
|
lnaddr = ''
|
||||||
|
elif not can_receive_lightning:
|
||||||
|
ln_help = _('Your Lightning channels do not have the capacity to receive this amount.')
|
||||||
|
lnaddr = ''
|
||||||
else:
|
else:
|
||||||
ln_help = ''
|
ln_help = ''
|
||||||
|
|
||||||
|
icon_name = "lightning.png" if lnaddr else "lightning_disconnected.png"
|
||||||
self.receive_tabs.setTabIcon(2, read_QIcon(icon_name))
|
self.receive_tabs.setTabIcon(2, read_QIcon(icon_name))
|
||||||
# encode lightning invoices as uppercase so QR encoding can use
|
# encode lightning invoices as uppercase so QR encoding can use
|
||||||
# alphanumeric mode; resulting in smaller QR codes
|
# alphanumeric mode; resulting in smaller QR codes
|
||||||
|
|||||||
Reference in New Issue
Block a user