1
0

qml: show channelbackups in channel list,

add channelbackups support in qechanneldetails.py,
only request-fclose option in CloseChannelDialog
This commit is contained in:
Sander van Grieken
2022-11-16 17:37:39 +01:00
parent 495d8d6fae
commit bc69e4f907
5 changed files with 34 additions and 15 deletions

View File

@@ -15,7 +15,8 @@ class QEChannelListModel(QAbstractListModel, QtEventListener):
# define listmodel rolemap
_ROLE_NAMES=('cid','state','state_code','initiator','capacity','can_send',
'can_receive','l_csv_delay','r_csv_delay','send_frozen','receive_frozen',
'type','node_id','node_alias','short_cid','funding_tx','is_trampoline')
'type','node_id','node_alias','short_cid','funding_tx','is_trampoline',
'is_backup')
_ROLE_KEYS = range(Qt.UserRole, Qt.UserRole + len(_ROLE_NAMES))
_ROLE_MAP = dict(zip(_ROLE_KEYS, [bytearray(x.encode()) for x in _ROLE_NAMES]))
_ROLE_RMAP = dict(zip(_ROLE_NAMES, _ROLE_KEYS))
@@ -72,10 +73,15 @@ class QEChannelListModel(QAbstractListModel, QtEventListener):
item['short_cid'] = lnc.short_id_for_GUI()
item['state'] = lnc.get_state_for_GUI()
item['state_code'] = int(lnc.get_state())
item['capacity'] = QEAmount(amount_sat=lnc.get_capacity())
item['can_send'] = QEAmount(amount_msat=lnc.available_to_spend(LOCAL))
item['can_receive'] = QEAmount(amount_msat=lnc.available_to_spend(REMOTE))
item['is_backup'] = lnc.is_backup()
item['is_trampoline'] = lnworker.is_trampoline_peer(lnc.node_id)
item['capacity'] = QEAmount(amount_sat=lnc.get_capacity())
if lnc.is_backup():
item['can_send'] = QEAmount()
item['can_receive'] = QEAmount()
else:
item['can_send'] = QEAmount(amount_msat=lnc.available_to_spend(LOCAL))
item['can_receive'] = QEAmount(amount_msat=lnc.available_to_spend(REMOTE))
return item
numOpenChannelsChanged = pyqtSignal()
@@ -94,9 +100,6 @@ class QEChannelListModel(QAbstractListModel, QtEventListener):
lnchannels = self.wallet.lnworker.get_channel_objects()
for channel in lnchannels.values():
if channel.is_backup():
# not implemented
continue
item = self.channel_to_model(channel)
channels.append(item)