Browse Source

qt/kivy ChannelsList: if node alias is unknown, display node id

instead of "unknown"
patch-4
SomberNight 4 years ago
parent
commit
7d7dcf0795
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 2
      electrum/gui/kivy/uix/dialogs/lightning_channels.py
  2. 2
      electrum/gui/qt/channels_list.py
  3. 9
      electrum/lnworker.py

2
electrum/gui/kivy/uix/dialogs/lightning_channels.py

@ -594,7 +594,7 @@ class LightningChannelsDialog(Factory.Popup):
item.active = not i.is_closed()
item.is_backup = i.is_backup()
item._chan = i
item.node_alias = lnworker.get_node_alias(i.node_id)
item.node_alias = lnworker.get_node_alias(i.node_id) or i.node_id.hex()
self.update_item(item)
channel_cards.add_widget(item)
self.update_can_send()

2
electrum/gui/qt/channels_list.py

@ -85,7 +85,7 @@ class ChannelsList(MyTreeView):
labels[subject] = label
status = chan.get_state_for_GUI()
closed = chan.is_closed()
node_alias = self.lnworker.get_node_alias(chan.node_id)
node_alias = self.lnworker.get_node_alias(chan.node_id) or chan.node_id.hex()
if isinstance(chan, Channel):
capacity_str = self.parent.format_amount(chan.constraints.capacity)
else:

9
electrum/lnworker.py

@ -270,17 +270,18 @@ class LNWorker(Logger, NetworkRetryManager[LNPeerAddr]):
def channels_for_peer(self, node_id: bytes) -> Dict[bytes, Channel]:
return {}
def get_node_alias(self, node_id: bytes) -> str:
def get_node_alias(self, node_id: bytes) -> Optional[str]:
"""Returns the alias of the node, or None if unknown."""
node_alias = None
if self.channel_db:
node_info = self.channel_db.get_node_info_for_node_id(node_id)
node_alias = (node_info.alias if node_info else '') or node_id.hex()
if node_info:
node_alias = node_info.alias
else:
for k, v in hardcoded_trampoline_nodes().items():
if v.pubkey == node_id:
node_alias = k
break
else:
node_alias = 'unknown'
return node_alias
async def maybe_listen(self):

Loading…
Cancel
Save