Browse Source
qt/kivy ChannelsList: if node alias is unknown, display node id
instead of "unknown"
patch-4
SomberNight
4 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
3 changed files with
7 additions and
6 deletions
-
electrum/gui/kivy/uix/dialogs/lightning_channels.py
-
electrum/gui/qt/channels_list.py
-
electrum/lnworker.py
|
@ -594,7 +594,7 @@ class LightningChannelsDialog(Factory.Popup): |
|
|
item.active = not i.is_closed() |
|
|
item.active = not i.is_closed() |
|
|
item.is_backup = i.is_backup() |
|
|
item.is_backup = i.is_backup() |
|
|
item._chan = i |
|
|
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) |
|
|
self.update_item(item) |
|
|
channel_cards.add_widget(item) |
|
|
channel_cards.add_widget(item) |
|
|
self.update_can_send() |
|
|
self.update_can_send() |
|
|
|
@ -85,7 +85,7 @@ class ChannelsList(MyTreeView): |
|
|
labels[subject] = label |
|
|
labels[subject] = label |
|
|
status = chan.get_state_for_GUI() |
|
|
status = chan.get_state_for_GUI() |
|
|
closed = chan.is_closed() |
|
|
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): |
|
|
if isinstance(chan, Channel): |
|
|
capacity_str = self.parent.format_amount(chan.constraints.capacity) |
|
|
capacity_str = self.parent.format_amount(chan.constraints.capacity) |
|
|
else: |
|
|
else: |
|
|
|
@ -270,17 +270,18 @@ class LNWorker(Logger, NetworkRetryManager[LNPeerAddr]): |
|
|
def channels_for_peer(self, node_id: bytes) -> Dict[bytes, Channel]: |
|
|
def channels_for_peer(self, node_id: bytes) -> Dict[bytes, Channel]: |
|
|
return {} |
|
|
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: |
|
|
if self.channel_db: |
|
|
node_info = self.channel_db.get_node_info_for_node_id(node_id) |
|
|
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: |
|
|
else: |
|
|
for k, v in hardcoded_trampoline_nodes().items(): |
|
|
for k, v in hardcoded_trampoline_nodes().items(): |
|
|
if v.pubkey == node_id: |
|
|
if v.pubkey == node_id: |
|
|
node_alias = k |
|
|
node_alias = k |
|
|
break |
|
|
break |
|
|
else: |
|
|
|
|
|
node_alias = 'unknown' |
|
|
|
|
|
return node_alias |
|
|
return node_alias |
|
|
|
|
|
|
|
|
async def maybe_listen(self): |
|
|
async def maybe_listen(self): |
|
|