Browse Source

kivy+qt: add channel type to details

patch-4
bitromortac 3 years ago
parent
commit
c203ce083a
No known key found for this signature in database GPG Key ID: 1965063FC13BEBE2
  1. 5
      electrum/gui/kivy/uix/dialogs/lightning_channels.py
  2. 1
      electrum/gui/qt/channel_details.py
  3. 4
      electrum/lnutil.py

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

@ -246,6 +246,7 @@ Builder.load_string(r'''
warning: ''
is_frozen_for_sending: False
is_frozen_for_receiving: False
channel_type:''
BoxLayout:
padding: '12dp', '12dp', '12dp', '12dp'
spacing: '12dp'
@ -294,6 +295,9 @@ Builder.load_string(r'''
BoxLabel:
text: _('Frozen (for receiving)')
value: str(root.is_frozen_for_receiving)
BoxLabel:
text: _('Channel type')
value: str(root.channel_type)
Widget:
size_hint: 1, 0.1
TopLabel:
@ -484,6 +488,7 @@ class ChannelDetailsPopup(Popup, Logger):
self.warning = '' if self.app.wallet.lnworker.channel_db or self.app.wallet.lnworker.is_trampoline_peer(chan.node_id) else _('Warning') + ': ' + msg
self.is_frozen_for_sending = chan.is_frozen_for_sending()
self.is_frozen_for_receiving = chan.is_frozen_for_receiving()
self.channel_type = chan.storage['channel_type'].name_minimal
self.update_action_dropdown()
def update_action_dropdown(self):

1
electrum/gui/qt/channel_details.py

@ -193,6 +193,7 @@ class ChannelDetailsDialog(QtWidgets.QDialog, MessageBoxMixin):
form_layout.addRow(_('Remote dust limit:'), self.dust_limit)
self.remote_reserve = self.window.format_amount_and_units(chan.config[REMOTE].reserve_sat)
form_layout.addRow(_('Remote reserve:'), SelectableLabel(self.remote_reserve))
form_layout.addRow(_('Channel type:'), SelectableLabel(chan.storage['channel_type'].name_minimal))
vbox.addLayout(form_layout)
# add htlc tree view to vbox (wouldn't scale correctly in QFormLayout)

4
electrum/lnutil.py

@ -1153,6 +1153,10 @@ class ChannelType(IntFlag):
byte_length = bit_length // 8 + int(bool(bit_length % 8))
return self.to_bytes(byte_length, byteorder='big')
@property
def name_minimal(self):
return self.name.replace('OPTION_', '')
del LNFC # name is ambiguous without context

Loading…
Cancel
Save