show capacity of channel backups in GUI
This commit is contained in:
@@ -461,7 +461,7 @@ class ChannelDetailsPopup(Popup, Logger):
|
|||||||
self.channel_id = bh2u(chan.channel_id)
|
self.channel_id = bh2u(chan.channel_id)
|
||||||
self.funding_txid = chan.funding_outpoint.txid
|
self.funding_txid = chan.funding_outpoint.txid
|
||||||
self.short_id = format_short_channel_id(chan.short_channel_id)
|
self.short_id = format_short_channel_id(chan.short_channel_id)
|
||||||
self.capacity = self.app.format_amount_and_units(chan.constraints.capacity)
|
self.capacity = self.app.format_amount_and_units(chan.get_capacity())
|
||||||
self.state = chan.get_state_for_GUI()
|
self.state = chan.get_state_for_GUI()
|
||||||
self.local_ctn = chan.get_latest_ctn(LOCAL)
|
self.local_ctn = chan.get_latest_ctn(LOCAL)
|
||||||
self.remote_ctn = chan.get_latest_ctn(REMOTE)
|
self.remote_ctn = chan.get_latest_ctn(REMOTE)
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ class ChannelDetailsDialog(QtWidgets.QDialog):
|
|||||||
form_layout.addRow(_('State:'), SelectableLabel(chan.get_state_for_GUI()))
|
form_layout.addRow(_('State:'), SelectableLabel(chan.get_state_for_GUI()))
|
||||||
self.initiator = 'Local' if chan.constraints.is_initiator else 'Remote'
|
self.initiator = 'Local' if chan.constraints.is_initiator else 'Remote'
|
||||||
form_layout.addRow(_('Initiator:'), SelectableLabel(self.initiator))
|
form_layout.addRow(_('Initiator:'), SelectableLabel(self.initiator))
|
||||||
self.capacity = self.window.format_amount_and_units(chan.constraints.capacity)
|
self.capacity = self.window.format_amount_and_units(chan.get_capacity())
|
||||||
form_layout.addRow(_('Capacity:'), SelectableLabel(self.capacity))
|
form_layout.addRow(_('Capacity:'), SelectableLabel(self.capacity))
|
||||||
self.can_send_label = SelectableLabel()
|
self.can_send_label = SelectableLabel()
|
||||||
self.can_receive_label = SelectableLabel()
|
self.can_receive_label = SelectableLabel()
|
||||||
|
|||||||
@@ -85,10 +85,7 @@ class ChannelsList(MyTreeView):
|
|||||||
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) or chan.node_id.hex()
|
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.get_capacity(), whitespaces=True)
|
||||||
capacity_str = self.parent.format_amount(chan.constraints.capacity, whitespaces=True)
|
|
||||||
else:
|
|
||||||
capacity_str = ''
|
|
||||||
return {
|
return {
|
||||||
self.Columns.SHORT_CHANID: chan.short_id_for_GUI(),
|
self.Columns.SHORT_CHANID: chan.short_id_for_GUI(),
|
||||||
self.Columns.NODE_ALIAS: node_alias,
|
self.Columns.NODE_ALIAS: node_alias,
|
||||||
|
|||||||
@@ -446,6 +446,9 @@ class ChannelBackup(AbstractChannel):
|
|||||||
self.lnworker = lnworker
|
self.lnworker = lnworker
|
||||||
self.short_channel_id = None
|
self.short_channel_id = None
|
||||||
|
|
||||||
|
def get_capacity(self):
|
||||||
|
return self.lnworker.lnwatcher.get_tx_delta(self.funding_outpoint.txid, self.cb.funding_address)
|
||||||
|
|
||||||
def is_backup(self):
|
def is_backup(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -538,6 +541,9 @@ class Channel(AbstractChannel):
|
|||||||
self._receive_fail_reasons = {} # type: Dict[int, (bytes, OnionRoutingFailure)]
|
self._receive_fail_reasons = {} # type: Dict[int, (bytes, OnionRoutingFailure)]
|
||||||
self._ignore_max_htlc_value = False # used in tests
|
self._ignore_max_htlc_value = False # used in tests
|
||||||
|
|
||||||
|
def get_capacity(self):
|
||||||
|
return self.constraints.capacity
|
||||||
|
|
||||||
def is_initiator(self):
|
def is_initiator(self):
|
||||||
return self.constraints.is_initiator
|
return self.constraints.is_initiator
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user